Match¶
| Name | Mandatory | Description | Default | Type | 
|---|---|---|---|---|
| ⬅️ Input | The value that's compared with the declared cases. | Any | ||
| Output ➡️ | Same value as input if :Passthroughistrueelse the output of the matched case's shard if:Passthroughisfalse. | Any | ||
| Cases | No | Values to match against the input. A nonecase will match anything. | [] | [Any] | 
| Passthrough | No | Parameter to control the shard's output. trueallows theMatchshard's input itself to appear as its output;falseallows the matched shard's output to appear asMatchshard's output. | true | Bool | 
Compares the input with the declared cases (in order of the declaration) and activates the shard of the first matched case.
Details¶
Match compares its input with every case declared via the Cases parameter (in the order of their declaration) till a match is found.
Once a match is found the shard of that matched case is activated/executed and Match execution stops. All subsequent cases (even matching ones) are ignored.
A none case matches anything, so it's a good practice to declare a none case at the end of Cases to execute some default logic if no valid matches exist for a given input. If you do not have a none case, then a non-matching input to Match will fail the shard.
A note on Passthrough¶
The Passthrough parameter can control the final output of the shard it applies to.
Setting this parameter to true allows the original input of a shard to pass through as its output as well. If this parameter is set to false, passthrough is suppressed and then the output of the shard is the actual computed value coming out from the shard execution.
Passthrough parameter set to true will allow the original input (the one that was used to match against every case in the shard) to be returned as the final output of Match, irrespective of the case match results. Setting Passthrough to false will enable the matched case's shard output to be returned as the final output of Match.
However, for Passthrough to work correctly, the data types of the shard input and the shard's case outputs must match.
Examples¶
| 1 2 3 4 5 6 7 |  | 
| 1 2 3 4 5 6 7 8 9 10 11 |  | 
| 1 2 3 4 5 6 7 8 9 |  | 
| 1 2 3 4 5 6 7 8 9 |  |