Specifying actions

An action expression is a sequence of statements. Like guards, actions are uninterpreted code chunks based on object attributes and event data.

About this task

There is no need to add a semicolon to the last statement;IBM® Rational® Rhapsody® adds one for you. Therefore, there is no need for any semicolon if there is only one statement.

The following example shows a transition consisting of a trigger and an action sequence with more than one step:

e1/x=1;y=2 // comments are allowed

Action expressions must be syntactically legal in the programming language. This requirement means they must be written within the context of the owner class (the one that owns the statechart being described). Therefore, all identifiers must be one of the following items:

Any other identifier causes failures at compile time.

Actions can reference the parameters of an event or operation as defined by the transition context, using the pseudo-variable params->. See also Specifying message parameters.


Feedback