JSX

a faster, safer, easier JavaScript
Powered by Oktavia

Statements

Following types of statements are supported by JSX. The differences from JavaScript are:

Table 1. Types of Statements
Statement Description
;
empty statement
{
    statement*
}
block statement
expr;
evaluates the expr
return;
returns void
return expr;
returns the result of the expr
throw expr;
throw an error object which can be caught by try statement
log expr;
displays expr to the console. log statements will be removed on release build
assert expr [, message];
throws a runtime error if expr is failsy with message or "assertion failure". assert statements will be removed on release build
debugger;
stops running and starts a debugger if available
delete expr;
deletes the property of a Map returned by the expr
classname(...);
calls the constructor of the class (this can be used to refer to the current class, super can be used for referring to the super class)
if (expr)
    statement
[else
    statement]
if statement
var varname[ = expr][, varname2 = expr2, ...];
variable declaration
break;
exits from the inner-most loop or switch statement
break LABEL;
exits to the loop or switch statement with label LABEL
continue;
skips to the end of the loop statement
continue LABEL;
skip to the end of the loop statement with label LABEL
[LABEL:]
do
    statement
while (expr);
[LABEL:]
for (expr in expr)
    statement
[LABEL:]
for (var varname in expr)
    statement
[LABEL:]
for (expr; expr; expr)
    statement
[LABEL:]
for (var varname = expr; expr; expr)
    statement
[LABEL:]
while (expr)
    statement
[LABEL:]switch (expr) {
    statement*
}
case expr:
    statement
allowed only inside switch statements
default:
    statement
allowed only inside switch statements
try {
    statement*
} [catch (varname : type) {
    statement*
}]* [finally {
    statement*
}]
catch statement can be nested
function name(arg1 : type [, ...]) : type {
    statement*
}