State variables and guard expressions enable specification of protocols in a behaviour section. They specify the selection of one of multiple different actions (see Actions) for an input event.
The state of an interface is composed of the values of all state variables.
The state diagram of an interface takes only the first variable declared into account.
State variable declarations can refer to public types (e.g. defined for use as event return values) or to private type declarations local to the 'behaviour' section. Types can be boolean, integer with limited contiguous range or enumerated.
Guards are boolean expressions based on state variables. The statement behind the guard is selected when the expression evaluates to true. The keyword 'otherwise' defines a catch-all guard which is true only when none of the other guard expressions in a list of guarded statements evaluates to true.