for directive
Syntax
for-directive: | for { <expr1> ; <expr2> ; <expr3> } <expr4> |
Description
Use for directive to get loop behaviour. for takes 4 expressions, each of which has its own purpose and term. First expression (expr1) is called "initialization expression," second expression (expr2) is called "condition," third expression (expr3) is "action," and the last expresion outside braces (expr4) is "loop body."
The logic for directive follows is:
1. The initialization expression is evaluated.
2. The condition is evaluated. If it evaluates to 0, the loop ends.
3. The loop body is evaluated.
4. The action is evaluated.
5. Process repeats from paragraph 2.
Examples
// Call AddFile user defined procedure 200 times
#for {i = 200; i > 0; i--} AddFile
More examples
FindFirst function, FileRead function.