共用方式為


sub

概要

傳回兩個整數的差異。

語法

sub(<operands>)

描述

函式會 sub() 傳回兩個整數的差異。 它會從第一個操作數減去第二個操作數。 您可以將的呼叫 sub() 巢狀化,以減去兩個以上的整數。

範例

範例 1 - 減去兩個整數

本範例文件說明如何使用 sub() 函式傳回兩個整數的差異。

# sub.example.1.dsc.config.yaml
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
resources:
- name: Subtract integers
  type: Microsoft.DSC.Debug/Echo
  properties:
    output: "[sub(7, 3)]"
dsc config get --file sub.example.1.dsc.config.yaml config get
results:
- name: Subtract integers
  type: Microsoft.DSC.Debug/Echo
  result:
    actualState:
      output: 4
messages: []
hadErrors: false

參數

運算元

sub() 式預期只有兩個整數做為輸入。 操作數可以是整數或傳回整數之任何組態函式的輸出。 以逗號分隔 操作 數 (,) 。

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

輸出

函式會 sub() 傳回代表 操作數差異的整數。

Type: integer