| Expression statement | block {} Statement | Branch Statements | Loop Statements | Type Declaration | Variable Declaration | Synchronize Statements | With Statement | Using Statement | Type Alias |
The with statement introduce a shortcut to
an often used expression.
WithStatement
: 'with' '(' Expression ')' Statement
The expression will be evaluated in the with statement.
Inside the Statement (normally a BlockStatement) the
expression is available when using the '.' operator.
with (acdk.lang.System.out)
{
.print("Hello ");
.print("in");
.println(" with statement");
}
|
Different to using statements the
with statement has an performance profit, because the with expression
will only be evaluated once.
With Statements can also be nested:
with (acdk.lang.System.out)
{
.println("This goes to out");
with (acdk.lang.System.err)
{
.println("This goes to err");
}
.println("This goes to out");
}
|
See also: Using Statement.
|