Skip to main content
Version: 7.0

Sequence ({...})

The sequence operator creates an action that runs a sequence of other actions one after another, in the written order. Execution stops as soon as one of the contained actions raises an interruption, next iteration or exit signal — the remaining actions are skipped and the signal is passed on to the surrounding action.

Together with the running actions, the sequence may also introduce local properties — data properties declared inside the block. A local property exists only while the sequence is being executed, and its changes are dropped when the sequence ends.

Language

To declare an action that executes a sequence of other actions, use the {...} operator — a block enclosed in curly braces, containing a sequence of action operators and local property declarations.

Examples

CLASS Currency;
name = DATA STRING[30] (Currency);
code = DATA INTEGER (Currency);

CLASS Order;
currency = DATA Currency (Order);
customer = DATA STRING[100] (Order);
copy 'Copy' (Order old) {
// an action is created that consists of the sequential execution of two actions
NEW new = Order {
currency(new) <- currency(old); // a semicolon is put after each statement
customer(new) <- customer(old);
} // there is no semicolon in this line, because the operator ends in }
}

loadDefaultCurrency(ISTRING[30] name, INTEGER code) {
NEW c = Currency {
name(c) <- name;
code(c) <- code;
}
}
run () {
loadDefaultCurrency('USD', 866);
loadDefaultCurrency('EUR', 1251);
}