| Conditionals | Repeating |
test ::= if
| unless
conditional ::= test
| assume
| XXX
elsif ::= elsif
else ::= else
cond-statement ::= conditional [s] test-expression [s] spec [statements]
[elsif [s] test-expression [s] spec [statements]]...
[else [s] spec [s] [statements]]
end [s conditional] [s]
Unless foo() is identical to if not(foo()).
Assume is a 'weighted if': the test is expected to succeed, so the
elsif and else code blocks are placed 'xxx', giving a slight
performance boost, but also make the default path much more clear.
Repeating
# list is sorted on name
# name is the node we are looking for
do `find-node` with:
my ListItem elem : nill;
while (elem := list.shareNextElement()):
next `find-node` if (name < elem.name());
bounce `find-node` if (name > elem.name());
leave `find-node`;
else:
elem := a ListItem(name);
list.addItemBefore(elem);
finally:
return elem;
end while;
do ::= do [s] [label [s]]
with ::= with [s] spec statements
repeat ::= repeat [s] spec loop-statements
continue ::= continue [s] spec loop-statements
else ::= else [s] spec statements
finally ::= finally [s] spec statements
control ::= do [with] repeat [continue] [else] [finally] end-do
end-do ::= end [s] [do [s]]
loop-statements ::= statement loop-statements
| loop-statement [condition];*
|
loop-statement ::= (next | redo | leave | bounce) [s] [label]