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.
Feedback Form ( ExpandCollapse)
|