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 |
- 1. WMLScript Introduction
- 2. Hello World WMLScript Example
- 3. Compiling WMLScript Code
- 4. WMLScript Language Rules
- 5. Defining WMLScript Functions
- 6. Calling WMLScript Functions
- 7. WMLScript Variables
- 8. WMLScript Data Types
- 9. WMLScript Variables Vs WML Variables
- 10. Passing Arguments to Functions By Value and By Reference
- 11. WMLScript Operators
- 12. WMLScript Conditional Statements
- 13. WMLScript Looping Statements
- 14. WMLScript Standard Libraries Overview
- 15. WMLScript WMLBrowser Standard Library
- 16. WMLScript Dialogs Standard Library
- 17. WMLScript String Standard Library
- 18. WMLScript Float Standard Library
- 19. WMLScript Lang Standard Library
- 20. WMLScript URL Standard Library
- 21. WMLScript Example: Validating Form Data