...
(2) WHILE/DO-WHILE Statement
The WHILE/DO-WHILE is a statement for a loop process. The statements below the while WHILE keyword will be repeated as long as the condition followed by the WHILE keyword is True.
...
The subordinate statements may will never be executed if the conditions for the WHILE statement are not true. If you use a DO-WHILE statementsstatement, you can execute the loop statement will be executed at least once. Then After the first execution, the system will check the condition within the WHILE statement.
...
In this statement, all expressions for the initialization, the decision-making, and the post-loop process are described in a single statement line.
...
The FOR statement is followed by the initialization statement, the decision-making statement, and the post-processing statement.
FOR (Initialization statement; Decision Making statement; Post-Processing statement)
In the example above, the loop statement will be executed 10 times. On the first execution, A will have a value of 0. After this, the statement “A=A+1“ will execute, and the loop will run again. The loop will continue to run until A is equal to 10 or greater.
(4) SWITCH-CASE Statement
This statement is used when the different processes are needed within the for different cases. Each case can be distinguished by the an unlimited number of CASE statements.
...
The DEFAULT statement does not need a constant. This statement is executed if none of the other cases are to be executed. The DEFAULT statement can be omitted if needlessit is not needed.
The BREAK keyword plays the role of terminating the SWITCH statement. If there is no BREAK keyword in the process of the program, the after a CASE statement, then corresponding CASE/DEFAULT statement statements will also be executed. This means that multiple CASEs can execute the same result, as shown in the example below.
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; } |
...
The GOTO statement controls the flow of the program directly. This statement uses an index (unique name starting with “@”) to point out to the new location.
The index name must not be duplicated with variables, tags, or program names.
...
The CONTINUE keyword is used in the loop statementstatements. When the system meets the CONTINUE keyword, the flow skips the remainder of the loop and 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.
...
The program MyPgm will be called in the other another program as shown below. Then the variable ‘RtnValue’ will receive the value ‘6’.
...
When you call an external program directly, the caller will be in stand-by mode until the called program (the external program) ends its operation.
However, if you use the RunScript keyword to call an external program, the caller will not wait until the end of the called program. Both the caller and called program will be executed in parallel.
...