The following table is a set of statements and keywords that can be used in the script.
If (A == 1)
{
// A program for when A is 1
}
Else If (A == 2)
{
// A program for when A is 2
}
Else
{
// A program for when A is neither 1 nor 2Type | Description | ||
| Evaluates | ||
| -… | Statements for loop processes. | Statements for loop processes.FOR As for the |
| A statement | SWITCH-CASE Statement | Statement for executing loop repeats until a specified condition becomes |
| Executing different processes based on different conditions. | ||
GOTO | A statement that forces the flow of the program to go to a specific location in the script. | ||
CONTINUE Keyword | A keyword used in loop processes. | ||
RETURN Keyword | A keyword that designates the value that will be returned to the caller. | ||
RUNSCRIPT Keyword | A keyword that calls an external program. |
(1) IF-ELSE Statement
The IF-ELSE statement is one of the most frequently used logical decision-making statements. It supports nested IF statements such as: If (condition 1) { If (condition 2) { … } }. There is no limit on the level of nested IF. The Else statement may be omitted. The ‘Else If’ statement is used for additional conditions following an If statement. For a given If-Else If-Else statement, only one branch will be executed. Once one condition is met, none of the following “Else If“ or “Else“ conditions are evaluated.
Terminates execution of the current iteration in a loop and then execute the next iteration in a loop. | |
| Terminates the execution of a loop entirely. |
| Ends function execution and specifies a value to be returned to the function caller. |
|
|
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
.
For example:
if (A == 1) {
//run this instruction if A is equal to 1.
}
else if (A == 2) {
//run this instruction if A is equal to 2.
}
else {
//run this instruction if A does not equal 1 or 2.
}
(2) WHILE/DO-WHILE Statement
...