Blocks of Statements
Another simple type of statement is the block
statement. This is simply a number of
statements collected together and surrounded with curly braces. These
are often used with if
statements and
while
and for
loops, to allow
the parts of the if
or the body of the loop to
contain more than one statement.
For example:
{} is an empty block |
{ a = b; } contains only one statement |
{ a = b; foo (); bar ( ); } contains three statements |
Get Learning WML, and WMLScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.