ON statement

Whenever an action is executed, it produces a result or edge. You can specify all possible results for each action, with a label for each. The next action executed is the one indicated by the label associated with the edge.

One edge may be the possible result of many actions in a state table so, to minimize coding effort and ensure consistency, you can include ON statements in your state table. The ON statement specifies that on finding that an action has resulted in this edge, go to this label. It is a global edge definition that applies to the whole state table rather than just one action. When any action that does not specify the edge itself results in the edge specified in the ON statement, the next action will be the one indicated by the label. Code the ON statement like this:

ON(edgename, label);

After coding ON statements for specific commonly-used edges, you can also code an ON statement with no edge. This ensures that there is a label to go to whenever any action results in an edge not specified either in that action statement or in another ON statement. Code the ON statement like this:

ON(label);

ON statements must be included at the beginning of the state table but, remember, they can always be overridden by coding the edge for an individual action.