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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.