ReferenceScript nodesUtilities › Flow Control
Switch on Number
Goes the way of the case the number equals, or Default (from older graphs: use Switch on Integer).
▸Switch on Number
Case 1
Selection0Case 2
Case 1 Value0Case 3
Case 2 Value1Default
Case 3 Value2
Inputs
| Pin | Type | Starts at | Notes |
|---|---|---|---|
in | what happens next | – | – |
Selectionvalue | number | 0 | – |
Case 1 Valuea | number | 0 | – |
Case 2 Valueb | number | 1 | – |
Case 3 Valuec | number | 2 | – |
Outputs
| Pin | Type |
|---|---|
Case 1isA | what happens next |
Case 2isB | what happens next |
Case 3isC | what happens next |
Defaultotherwise | what happens next |
The code it becomes
The graph below written as a script would write it.
// On Scene Start{ const v = 0; if (v === 0) { } else if (v === 1) { } else if (v === 2) { } else { }}In a graph
◆On Scene Start
▸Switch on Number
Case 1
Selection0Case 2
Case 1 Value0Case 3
Case 2 Value1Default
Case 3 Value2
The node with what starts it and Print to show what it gives, as Studio draws them.
Related
Notes from the community
Written by creators and checked by the docs' editors. Not part of Motion's official reference.