switch

This block is part of the condition group and was last modified in core v12.0.4.

switch v12.0.4

Returns a condition based on the given expression.

In pins 2
  • expression required
    value

    The expression to evaluate.

  • default
    condition

    The default statement to be executed.

Out pins 2
  • output
    condition

    Returns the condition matching the expression.

  • match
    condition

    Returns true in case a match was found.

Matches the string on the value pin against the case states by exact, case-sensitive comparison. On a match: condition outputs whether that case's pin is exactly boolean true, and matched outputs true. On no match: matched is false and condition is the default pin's value when that value is truthy, otherwise nil. A falsy or non-string value never matches any case.

A typical wiring for switch: the condition out pin feeds branch.

Studio canvas example for the switch block: typical wiring for switch.

Version history

Introduced in v12.0.4.


Back to condition Return to the main group to view all sub-groups Back to condition Return to the group to view all blocks within this group