...
Type | Description |
IF-ELSE Statement | One of the most frequently used logical decision-making statements. |
WHILE/DO-WHILE Statement | Statements for the loop process. |
FOR Statement | More complex but useful for loop processes. |
SWITCH-CASE Statement | Statement for the different processes according to the several cases. |
GOTO Statement | A statement that forces the flow of program. |
CONTINUE Keyword | A keyword used in the loop process. |
RETURN Keyword | A keyword that designates the value that will be returned to the caller. |
RUNSCRIPT Keyword | A keyword that calls the external program. |
(1) IF-ELSE Statement
IF-ELSE statement is one of the most frequently used logical decision-making statements. It supports nested IF statements such as: IF-ELSE IF-ELSE IF…. There is no limit on the level of nested IF. The Else statement may be omitted.
If (A == 1) { // A program when A is 1 } Else { // A program when A is not 1 } |
(2)
...
WHILE/DO-WHILE Statement
WHILE/DO-WHILE is a statement for a loop process. The statements below the while keyword will be repeated as long as the condition followed by the WHILE keyword is True.
...
Do { // Write the loop statement when the condition is True. // The loop statement will be executed once at least. } While (A<10); // mark the end of the statement with ‘ ; ’. |
(3) FOR Statement
In this statement, all expressions for the initialization, the decision-making, and the post loop process are described in a single statement line.
...
FOR (Initialization statement; Decision Making statement; Post Processing statement)
(4)
...
SWITCH-CASE Statement
This statement is used when the different processes are needed within the different cases. Each case can be distinguished by the unlimited number of CASE statements.
...
Switch (A) { Case 1: // Write the program when A is 1. Break; Case 5: Case 7: // Write the program when A is 5 or 7. Break; Default: // Write the default program. This section can be omitted. Break; } |
...
(5)
...
GOTO Statement
The GOTO statement controls the flow of the program directly. This statement uses an index (unique name starting with “@”) to point out the new location.
...
VAR A;
A = 0; @ComeHere // Assign an index. If (A < 10) { A = A + 1 Goto ComeHere; // Move to the assigned index. } |
(6) CONTINUE Keyword
The CONTINUE keyword is used in the loop statement. When the system meets the CONTINUE keyword, the flow moves to the first part of the current loop. This keyword is often used in the WHILE, DO-WHILE, and FOR statements. It is especially useful when there are multiple decision-making statements (IF-ELSE) in the loop.
...
While (A<10) { A = A +1; If (A < 5) { // Process when A is less than 5 Continue; } // Process when A is greater than or equal to 5 } |
(7) RETURN Keyword
Every program returns a result value to the caller. The RETURN keyword is used for designating a return value and termination of the program.
...
RtnValue = MyPgm(1, 2, 3); |
(8)
...
RUNSCRIPT Keyword
When you call an external program, the caller will be in stand-by mode until the called program (the external program) ends its operation.
...