Guards
A guard is a condition that the machine checks when it goes through an event. If the condition is true, the machine follows the transition to the next state. If the condition is false, the machine follows the rest of the conditions to the next state. Any transition can be a guarded transition.
Replace event with a guard
When multiple guard conditions are added to one transition, the guards will be numbered in order. The first guard will be labeled IF and subsequent guards will be labeled ELSE.
On the canvas
- Select the event you want to replace with a guarded transition.
- Use the plus icon button to open the edit menu.
- Choose Guard condition from the menu to add a guarded transition.
- Enter your condition into the text input.
Using the transition Details panel
- Open the transition Details panel from the right tool menu.
- Use the Guard text input to name your guard’s condition and replace your event with a guarded transition.