Skip to content

Const

Name Mandatory Description Default Type
⬅️ Input Any input is ignored. None
Output ➡️ The declared constant value. Any
Value No The constant value to insert in the wire. none Any

Declares an un-named constant value (of any data type).

Details

To create named constants see Ref.

You can even skip this shard and pass the constant value directly but internally it will be translated to a Const shard that outputs this constant value.

See also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
; declare an int with `Const` and consume in `Math.Multiply`
Const(Value: 2) | Math.Multiply(4) | Log         ; => 8

; declare an int without `Const` and consume in `Math.Multiply`
2 | Math.Multiply(4) | Log       ; => 8

; declare a string with `Const`
Const("Hello World!") | Log    ; => "Hello World!"

; declare a sequence with `Const`
Const(["A" "B" "C"]) | Log     ; => ["A" "B" "C"]

; declare a Float4 with `Const`
Const(@f4(1 2 3 4)) | Log  ; => @f4(1 2 3 4)

; declare a table with `Const`
Const({key1: 10 key2: 20.0}) | Log  ; => {key1: 10 key2: 20.0}

; nullifying the input to a shard with Const(none)
"Hello World"        ; string input for Log
Const(none)         ; nulls the string input
Log                ; Log gets no input => None

[info] [sample-wire] 8
[info] [sample-wire] 8
[info] [sample-wire] Hello World!
[info] [sample-wire] [A B C]
[info] [sample-wire] @f4(1 2 3 4)
[info] [sample-wire] {key1: 10 key2: 20}
[info] [sample-wire] none