Skip to content

Conditions and routing: Condition and Switch

Video coming soon — step-by-step guide below

Branch on a JS condition and on an exact value.

What you need

  • A scenario that already has a variable (e.g. the age from the previous video)

Steps

  1. Add a Condition with an expression such as #node.12.age >= 18.
  2. Connect the True and False outputs to different screens.
  3. Add a Switch to route on an exact value, e.g. city: cases Kyiv, Lviv and default.
  4. Test both nodes in the messenger with different answers.

Resulting scenario

Condition "#node.12.age >= 18"
  | True  -> Switch "#node.7.city"
  |          | "Kyiv"  -> Screen "Kyiv"
  |          | "Lviv"  -> Screen "Lviv"
  |          | default -> Screen "Other cities"
  | False -> Screen "18+ only"

Learn more