Performs FOR-Loop iterative statements.
FOR(expr1, expr2, expr3, statements)
FOR (expr1; expr2; expr3) { statements; }
expr1 |
- |
An expression initializing the counter variable. |
expr2 |
- |
A conditional expression used to test the counter variable before each iteration. If non-zero, statement is evaluated. |
expr3 |
- |
An expression evaluated after each iteration of statement. |
statements |
- |
Any valid expressions separated by semicolons. The statements to execute after each iteration. |
sets j equal to 1 and increments j by 1 until j equals 10 while echoing j to the status line.
The SPL function, WinSines:
increments local variable, i, and fills each Window in the Worksheet with a sinewave of the same frequency as the Window number. Note since i is declared as a local, it does not conflict with the built-in constant
The FOR function uses the same ; and , syntax as C/C++.
The expression:
is equivalent to:
See LOOP for a faster, but less flexible iteration construct.
For best performance, try to avoid loops altogether by exploiting the vectorized nature of SPL. For example:
can be performed much faster, more intuitively and concisely with:
or even faster with: