4. WMLScript Language Rules

WMLScript is developed based on ECMAScript, which is the standardized version of JavaScript. Thus, WMLScript's language rules are very similar to that of JavaScript.


4.1. Semicolons at the End of WMLScript Statements

A semicolon is required to end a statement in WMLScript. This is the same as C++ and Java. Note that JavaScript does not have such requirement. In JavaScript, semicolons are optional. The following code is taken from the earlier "Hello World" example. You can see that the two WMLScript statements in this function are ended with semicolons.


extern function helloWorld()
{
  WMLBrowser.setVar("message", "Hello World. Welcome to our WMLScript tutorial.");
  WMLBrowser.refresh();
}


4.2. Whitespaces in WMLScript

Except in string literals, WMLScript ignores extra whitespaces like spaces, tabs and newlines. Hence, the code in the earlier "Hello World" example can be typed in the following way and the result will remain the same:


extern     function helloWorld()
{
                    WMLBrowser.setVar(
"message",
   "Hello World. Welcome to our WMLScript tutorial.");
         WMLBrowser.refresh();
}


4.3. Case Sensitivity in WMLScript

The WMLScript language is case-sensitive. For example, a WMLScript function with the name WMLScript_Function is different from wmlscript_function. So, be careful of the capitalization when defining or referring to a function or a variable in WMLScript.


Previous Page Page 4 of 71 Next Page


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.