choose

| Name | Type | Description | Optional |
|---|---|---|---|
case0 |
?0 |
case selector for out0 |
yes |
case1 |
?0 |
case selector for out1 |
yes |
… |
|||
case N-1 |
?0 |
case selector for out N-1 |
yes |
| Name | Type | Description | Optional |
|---|---|---|---|
selector |
?0 |
selector for the current output |
no |
in0 |
?1 |
input selected when case0 is matched |
yes |
in1 |
?1 |
input selected when case1 is matched |
yes |
… |
|||
in N-1 |
?1 |
input selected when case N-1 is matched |
yes |
Roughly speaking, choose is the inverse of switch. choose reads its selector input without removing the data item. if there is a case label that is equal to the selector value, it attempts to read a value from the corresponding input, otherwise it attempts to read a value from the default input, if there is one, and otherwise it is an error. If there is data present on the selected input, it outputs it to the output port, and removes the item at the head of its selector input. Otherwise, it leaves the selector input as it was and does nothing – it will be fired later and the process repeated until the selected data is successfully read from the selected input port. The data input ports are untriggered (hence depicted as circles), meaning that they are not guaranteed to have data present when the node fires. It is not possible in our intended usage of these nodes to require that data be present on all the input ports simultaneously, since they represent mutually exclusive logical conditions.
It is strongly recommended that choose always be paired with a matching switch node, and that the conditional branches that are controlled by the` switch / choose` pair be placed in their own circuits, per the guidelines given in Dataflow in Coreograph (Conditionals).