Other Statements
Variable
declarations with
var
are considered
statements
in WMLScript; so they can appear anywhere that a statement can. You
don’t have to stick them all at the top of a function as you do
in some languages. For example:
foo ( ); var x = 0105; bar (x);
Sometimes, you want a statement that doesn’t do anything. You
can do this with an empty block, {}
, but
you can also simply use a single semicolon, which is a statement that
does nothing. For example:
while (test_value (++x)) { /* Empty block. */ }
or:
while (test_value (++x)) ;
Writing loops like this, with all of the work crammed into the loop header, is often regarded as bad style; it can make your code hard to read.
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.