Statements
Simple statement
An expression followed with an optional semicolon.
Compound statement
A sequence of statements between braces.
JSON statement
An expression optionally followed with a comma.
Iteration statements
for
loop
for (
expression ;
expression ;
expression )
statement
Consists of three expressions between parenthesis spliced with semicolons followed with a statement. Executes the first expression and then while the value of the second expression is true executes the third expression and the statement.
for (
left expression in
expression )
statement
Iterates over iterable object. Invokes itarator
method on the result of second expression, result of invoking iterator
method should satisfy iterator requirements. First expression should be in form identifier, expression.identifier or let identifier. Equivalent of:
let leftExpression
let it <- expression.iterator()
while (!(leftExpression <- it.next()) is Iterator.end)
statement
while
loop
while (
expression )
statement
Consists of condition between parenthesis followed with a statement. While the condition is true executes the statement.
Control flow
if
… else
statement
if (
expression )
statement
if (
expression )
statement else
statement
If the condition is true, then executes the statement.
try
… catch
statement
try
statement catch
statement
Executes the first statement. If an exception is thrown, stops the execution of the first statement, declares variable exception
, and executes the second statement.
return
statement
return
expression
Ends execution of functions. The value of the current function call is a
.
throw
statement
throw
expression
Stops execution of current context. Throws a
.
break
Exits loop. Usage of break
outside the loop results in undefined behavior.