次の方法で共有


sub

概要

2 つの整数の差を返します。

構文

sub(<operands>)

説明

関数は sub() 、2 つの整数の差を返します。 最初のオペランドから 2 番目のオペランドを減算します。 への呼び出しを sub() 入れ子にして、2 つ以上の整数を減算できます。

例 1 - 2 つの整数を減算する

このドキュメントの例では、 関数を sub() 使用して 2 つの整数の差を返す方法を示します。

# sub.example.1.dsc.config.yaml
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: Subtract integers
  type: Test/Echo
  properties:
    output: "[sub(7, 3)]"
dsc config get --document sub.example.1.dsc.config.yaml config get
results:
- name: Subtract integers
  type: Test/Echo
  result:
    actualState:
      output: 4
messages: []
hadErrors: false

パラメーター

オペランド

関数では sub() 、入力として 2 つの整数が必要です。 オペランドには、整数または整数を返す任意の構成関数の出力を指定できます。 オペランドをコンマ (,) で区切ります。

Type:         integer
Required:     true
MinimumCount: 2
MaximumCount: 2

出力

関数はsub()、オペランドの差を表す整数を返します。

Type: integer