Sub
This shard subtracts the value provided in the Operand parameter from the input value.
Examples
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 | ; ; Using `Sub`, with `->`
5 ; ; input to `Sub` shards
Sub({Math.Multiply(2)
Log
}) ; ; 5 * 2 => 10
Sub({Math.Multiply(3)
Log ; ; 5 * 3 => 15
Sub({Math.Multiply(2)
Log
})
}) ; ; 15 * 2 => 30
Log("output of the last `Sub` shard") ; ; input is output => 5
; ; Using '{}' as an alias for sub
100 ; ; input to `|` shards
{Math.Multiply(2)
Log
} ; ; 100 * 2 => 200
{Math.Multiply(3)
Log ; ; 100 * 3 => 300
{Math.Multiply(2)
Log
}
} ; ; 300 * 2 => 600
Log("output of the last `|` shard")
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 | 5
Log("input to Sub1") ; ; => 5
Sub({
Math.Multiply(2)
Assert.Is(10 true)
Log("Sub1 inner shard o/p | 5 * 2") ; ; => 10
})
Log("Sub1 output => input to Sub2") ; ; => 5
Sub({
Math.Multiply(3)
Assert.Is(15 true)
Log("Sub2 inner shard o/p | 5 * 3") ; ; => 15
Log("input to nested-Sub") ; ; => 15
Sub({
Math.Multiply(2)
Assert.Is(30 true)
Log("nested-Sub inner shard o/p | (5 * 3) * 2") ; ; => 30
})
Log("output from nested Sub") ; ; => 15
})
Log("Sub2 output => output")
|