As an editing language, WMLScript provides powerful functions, statements and library functions, as well as external editing, access control and other support, at the same time, in the operation of the program may produce errors in the detection methods and specific solutions. These are part of WMLScript's scripting knowledge and further programming requirements, which we will introduce in detail in this chapter.
5.1 Statements
We've learned about variables, operators, and expressions, but only these things don't do a complete function because they can't form a complete operation or handler. A variable is like a serious word, an expression such as a phrase in a language, and they cannot express a complete meaning; Only a statement is a complete sentence in a language that can express a complete meaning and achieve a complete function. WML script provides rich statement functionality that allows us to create interactive functions and other complex functions that are required in a WML card.
In WML script, each statement needs to be followed by a semicolon (;) end. In order to develop a rigorous programming style, we recommend that you write a script, the statement must be followed by semicolons (;), which also helps us to form a good programming habit.
The writing and arranging format of WML script statements is relatively free. We can write multiple statements consecutively in the same program line, or we can split the same statement into multiple lines. The WML script determines the specific contents of the statement according to the semicolon (;).
The statements of WML script mainly consist of two classes. The first class is the basic statements, such as empty statements, expression statements, block statements, variable statements and return statements, and so on; the second class is conditional statements, such as if statements, and the third is circular statements, such as while statements, for statements, break statements, and continue statements. Below we explain the syntax, function, and usage of these statements respectively.
5.1.1 Basic Statement
The WML script Base statement is mainly used for program format control and variable declarations, some of which are not unfamiliar to us.
Empty statement
An empty statement is used to define an empty program line that does not have any identifiers and operators, nor does it perform any action. It just ends with a semicolon (;). The syntax format is:
;
Obviously, an empty statement is a very special statement. In order to make the program more readable, we usually add a few empty statements in the appropriate place in the program to play a separate or prominent role. For example, the following several lines of programs contain an empty statement:
Str= "Hello";
val=25;
;
myval=val*val+5;
Alert ("Hi,hi!!!");
Current 1/9 page
123456789 Next read the full text