Description: This statement repeatedly executes a parameter while a condition is true.
Returns: Nothing
Usage: Script
Format: WhileLoop(Condition, Function1, Function2, ...)
Parameters: Condition { Boolean } { required } { no default: }
An expression that will be evaluated to determine if the Function parameters should be executed. If it is true, the Function parameters will be executed and then Condition will be re-evaluated and the process repeated until Condition is either false or invalid.
Function1, Function2, ... { varies } { required } { no default: }
Are any expressions which are to be executed while Condition is true. The Function parameters are executed in order.
Comments: No other statement will execute as long as Condition is true. Care must be taken that the statement terminates since it has the potential of locking up the system if it never exits.
Note: While the WhileLoop statement has its place in VTS programming, it should be noted that speed can be enhanced by a factor of approximately 5 through the use of array processing functions (please refer to Array Processing for further details). Array functions are listed in Array Functions.
Example:
i = 1;
...
If 1 Main;
[
WhileLoop(i < 100 { Looping condition },
arrayEven[i] = i * 2 { Store even numbers },
arrayOdd[i] = i * 2 - 1 { Store odd numbers },
i++);
]
This causes all even numbers from 1 to 198 to be stored in arrayEven and all odd numbers from 1 to 198 to be stored in arrayOdd.
See Also: