As in C, every expression can serve as a statement, provided that it is followed by a semicolon ;
.
In particular, assignments var=
expr;
are statements.
The other kinds of statements are:
- conditional:
if
exprthen
statement1 [else
statement2];
if expr is true, then execute statement1;
else, ifelse
branch is present, execute statement2
Typing:- Requires: expr :
int
- Requires: expr :
- split regex:
split
regexp/
var1,
…,
varn/
expr
match value of expr against regexp (an explicit string constant)
store values of parenthesized sub-regexps into variables var1, …, varn respectively
Typing:- Requires: var :
str
var1 :str
… varn :str
Error messages:
"duplicate variable
variin split regex"
variappears twice or more in list of variables var1, …, varn
- Requires: var :