description | ms.date | ms.topic | title |
---|---|---|---|
Reference for the 'mul' DSC configuration document function |
03/20/2024 |
reference |
mul |
Returns the product of multiplying two integers.
mul(<operands>)
The mul()
function returns the product of multiplying two integers. It multiplies the first operand
by the second operand. You can nest calls to mul()
to multiply more than two integers.
This example document multiplies two integers to return a product for the output.
# mul.example.1.dsc.config.yaml
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: Multiplying integers
type: Test/Echo
properties:
output: "[mul(3, 5)]"
dsc config get --document mul.example.1.dsc.config.yaml config get
results:
- name: Multiplying integers
type: Test/Echo
result:
actualState:
output: 15
messages: []
hadErrors: false
This document shows how you can multiply the output of nested configuration functions.
# mul.example.2.dsc.config.yaml
$schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/config/document.json
resources:
- name: Multiplying nested function outputs
type: Test/Echo
properties:
output: "[mul(add(3, 2), div(12, 4))]"
dsc config get --document mul.example.2.dsc.config.yaml
results:
- name: Multiplying nested function outputs
type: Test/Echo
result:
actualState:
output: 15
messages: []
hadErrors: false
The mul()
function expects exactly two integers as input. The operands can be either an integer
or the output of any configuration function that returns an integer. The function divides the first
operand by the second operand. Separate the operands with a comma (,
).
Type: integer
Required: true
MinimumCount: 2
MaximumCount: 2
The mul()
function returns an integer representing the product of the multiplied operands.
Type: integer