The following table is a set of statements and keywords that can be used in the script.
Type | Description |
if …else Statementif …else is a condition statements. It evaluates the expression after if . If the expression is true, then the code immediately following "if" will be executed. Otherwise, the contents immediately following "else" will be executed. The user can specify multiple cases to evaluate by using the else -if expression
| The if statement executes the instruction code when the condition is true. Otherwise, the else statement will execute its instruction code. if ...else statements can be nested inside of another if ...else statement using the else if statement. Please note that there is no limitation on how many else if can be nested inside of if ...else . |
while /do …while Statement
| Statements for loop processes. while loop expression will continue to execute until the expression becomes false . As for the do …while loop, do instruction code will always be executed at least once before while expression is evaluated. The loop will repeat until while expression becomes false . |
for Statement
| A for loop repeats until a specified condition becomes false . |
switch …case Statement
| Executing different processes based on different conditions. |
continue Statement
| Terminates execution of the current iteration in a loop and then execute the next iteration in a loop. |
break Statement
| Terminates the execution of a loop entirely. |
return Function
| Ends function execution and specifies a value to be returned to the function caller. |
runScript() Function
| runScript() is used to call another script program. For example, if runScript() is being used in script name "A" to call a script name "B", as soon as script A executes, script B will execute as well.
|
if
...else
The if
statement executes the instruction code when the condition is true. Otherwise, the else
statement will execute its instruction code. if
...else
statements can be nested inside of another if
...else
statement using the else if
statement. Please note that there is no limitation on how many else if
can be nested inside of if
...else
.
...
Example for if
…else
:
if (A == 1) {
//run this instruction if A is equal to 1.
...
//run this instruction if A does not equal 1 or 2.
}
(2) WHILE/DO-WHILE Statement
...
Example forwhile
/do
…while
:
The statements below the WHILE keyword will be repeated as long as the condition followed by the WHILE keyword is True.
...