Statements

show/hide definitions.
{ <statements> }
A sequence of statements, delimited by the curly brackets, '{' and '}', is called a block. A block is itself a statement. Each block establishes its own namespace for the variables declared by the var and const statements.
if ( <expression> ) <statement> [ else <statement> ]
Conditionally executes a statement, depending on the result of the <expression>.
while [ : name ] ( <expression> ) <statement>
Executes <statement> while the <expression> evaluates to true. The label can be used in named break, and continue statements.
do [ : label ] <statement> while ( <expression> )
Executes the <statement> once, and then repeats execution of the statement while the <expression> evaluates to true.
for [ : label ] ( <init-expression> | var <name-with-initialization> ; [<condition-expression>] ; [<inc-expression>] ) <statement>
Executes the <statement> as long as the <condition-expression> evaluates to true.
for [ : label ] ( [ var ] <name> in <expression> ) <statement> [ otherwise <statement> ]
Executes the <statement> for every element contained in an array, object, or a function (a.k.a. generator-function). If the <expression> is an array, the <name> variable receives consecutive members of the array on each iteration. For the object, it receives the name (a.k.a. key) of each property. If the <expression> is a function, the for-in will invoke the function on each itearation until the function returns nothing. This happens if the function reaches the end of its body without a return statement (but it returns the nothing value in this case).
If body of the loop neither executes (e.g. when the <expression> evaluates to an empty array) then the statement after otherwise is executed (if it is present).
for [ : label ] ( [ var ] <name-list> in <expression> ) <statement> [ otherwise <statement> ]
Where the <name-list> is list of variables separated by the comma , and enclosed by ( ) parentheses.
This form of the for-in executes the <statement> for every element contained in an array, object, or a function (a.k.a. generator-function).
If the <expression> is an array, the variables in the name-list receive consecutive index value and value of the correspondent array member on each iteration. For the object, first variable receives the name (a.k.a. key) of the property and second variable will receive the value of the property. If the <expression> is a function, the for-in will invoke the function on each itearation until the function returns nothing. Variables in the <name-list> will receive returned value of values if the function returns list of values.
Examples:
for( var (k,v) in obj ) stdout.printf("k=%s,v=%v,", k, v);  - prints names and values of each property of the object.
for( var (i,v) in arr ) stdout.printf("i=%d,v=%v,", i, v);  - prints indexes and values of each member of the array.
If body of the loop neither executes (e.g. when the <expression> evaluates to an empty array) then the statement after otherwise is executed (if it is present).
switch ( <selector-expression> ) { case <case-expression> : <statements> [...] default: <statement> }
The switch statement allows to select one of the many blocks of code for execution. When the result of <case-expression> equals the value of the <selector-expression>, the corresponding <statements> are executed. If there is no matching <case-expression>, the statements marked by the default: label get executed (if present).
break [label] ;
The break statement terminates the execution of loops (for, for in, while or do/while) and switch statements. If the label is provided, it's a so-called named break statement. It breaks the outer loop, marked by the corresponding label. It is a syntax error if no such label is found in the current scope.
Example:
for:outer ( var row in rows )
for:x ( var cell in row )
 if ( cell == current ) break outer;
continue [label] ;
The continue statement forces a loop (for, for in, while or do/while) to skip to the next iteration. If the label is provided, it's a so called named continue statement. It will iterates the outer loop, marked by the corresponding label. It is a syntax error if no such label is found in the current scope.
var <name-or-name-list> [ = <init-expression>] [ , <name> [= <init-expression>] ... ] ;
The var statement introduces a new variable local to the current scope. Blocks ( { ... } ) establish variable scopes in the language. (Note: In JavaScript, the scope is established only by the body of a function).
<name-or-name-list> here is either single <name> or group of names enclosed by ( and  ) parentheses and separated by the comma ,
Example:
var (a,b,c) = 1; - declares variables a,b,c and assigns value '1' to them.
var (a,b,c) = (1,2,3); - equivalent of var a = 1, b = 2, c = 3;
return [ <expression> | <expression-list> ] ;
The return statement terminates the execution of the current function, optionally returning the result of the <expression> or <expression-list>. If the expression is omitted, the function will return the special undefined value.
Note that the return can return multiple values by providing expressions list:
function rect() { return (10,10,100,100); }
var (x,y,width,height) = rect(); // x and y get '10' and width and height get '100' values.
const <name> = <init-expression> [ , <name> = <init-expression> ... ] ;
The const statement introduces a new named constant, local to the current scope. Autside the const statement, any attempt to assign another value to the <name> will generate a compile-time error.
try <statement> catch ( <variable-name> ) <catch-statement> finally <finally-statement>
The try statement encloses a block of code in which an exceptional condition may occur, such as a runtime error, or a throw statement. The catch clause provides the exception handling code. When a catch clause catches an exception, its <variable-name> is bound to that exception. The <finally-statement> is executed unconditionally after the try block - both in the case of an exception, and if the <statement> executes normally.
assert <test-expression> [ : <info-expression> ] ;
The assert statement allows you to test assumptions about your program. When the <test-expression> evalutes to false at runtime, an error is thrown with the source text of the <test-expression> and <info-expression> (if any).
<expression> ;
Expressions that end with ';' constitute a single statement. Result of the <expression> is suppressed.