Skip to content

Sub

Name Mandatory Description Default Type
⬅️ Input The value or the sequence of values to subtract the value specified in the Operand parameter from. IntInt2Int3Int4Int8Int16FloatFloat2Float3Float4Color[Any]
Output ➡️ This shard outputs the result of the subtraction. IntInt2Int3Int4Int8Int16FloatFloat2Float3Float4Color[Any]
Operand No The value or sequence of values to subtract from the input. 0 IntVar(Int)Int2Var(Int2)Int3Var(Int3)Int4Var(Int4)Int8Var(Int8)Int16Var(Int16)FloatVar(Float)Float2Var(Float2)Float3Var(Float3)Float4Var(Float4)ColorVar(Color)[Any]Var([Any])

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")