Description: This function executes a do-while loop in a script.
Returns: Nothing
Usage: Script
Format: DoLoop(Function1, Function2, …, Condition)
Parameters:
Function1, Function2, …
{ text } { required } { no default
}
Any expression or
statement. This is the body of the loop. All of the Function parameters are executed in order prior to
testing the Condition parameter.
Condition { Boolean } { required } {
no default }
Any
logical expression for the loop control. As long as this is true, the loop will
repeat.
Comments: The Function parameters are executed at least once, then Condition is checked. If Condition is true, the Function parameters are executed and Condition is executed again. This repeats until Condition is false.
Note: Great care must be taken with this statement since all other VTS statements cannot execute until the loop is complete; this statement has the potential to lock up the system if the Condition never becomes false.
Note: While the DoLoop 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 = 0;
If 1 Main;
[
DoLoop(x[i] = Concat("Pump ", i),
i++,
i < 10);
]
This loop executes 10 times, assigning a text string to the next element of x on each iteration.
See Also: