Const¶
Name | - | Description | Default | Type |
---|---|---|---|---|
<input> |
Any input is ignored. | |||
<output> |
The declared constant value. | Any |
||
Value |
The constant value to insert in the wire. | None |
Any |
Declares an un-named constant value (of any data type).
Details¶
Const
declares a constant value (of any data type) by passing it into the parameter :Value
. Such a value is usually declared for use as input in other shards.
A constant value declared with Const
is un-named i.e., it is not assigned to any variable or allocated any alias. Hence it cannot be invoked or referred to later. 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. However, it's good practice to use this keyword in while passing constants in Shards programs.
You can also use (Const nil)
to overwrite/nullify (since nil
stands for null data) the input to the subsequent shard, if required (see the last code sample).
Input field is ignored and the output of this shard is the constant value defined by it.
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 |
|
[info] [shards/General/Const/Const.edn] 8
[info] [shards/General/Const/Const.edn] 8
[info] [shards/General/Const/Const.edn] Hello World!
[info] [shards/General/Const/Const.edn] [A B C]
[info] [shards/General/Const/Const.edn] (1 2 3 4)
[info] [shards/General/Const/Const.edn] {key1: 10 key2: 20}
[info] [shards/General/Const/Const.edn] None