O'Reilly logo

Learning WML, and WMLScript by Martin Frost

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required