DO Command
Description:
The DO and ENDDO commands allow a set of commands to be repeated a fixed number of times. The section of a script to be repeated is terminated by an ENDDO command.
Format:
DO variable = value1, value2 {, step} command{s} ENDDOParameters:
variable
The name of the control or index variable that is adjusted each time the loop executes. The adjustment is determined by the value of the step variable. This must be an integer variable.
value1
The starting value of the control variable. This must be either an integer variable or an integer value.
value2
The terminating value of the control variable. This must be an integer variable or value, and may be either higher or lower than value1. When the control variable contains a value that is greater than this value (or lower if the step is negative), the loop will be terminated.
step
An integer variable or value determining the value by which the control variable or index variable is incremented each time the loop executes. If value2 is less than value1, then the step value must be negative. If a step variable is not specified, then the step value will default to 1.
Examples:
DO Empno = 1, 1000 NEXT Name LOG 'Employee number: ', Empno, '; Name: ', Name ENDDO DO Empno = START, END, 10 NEXT Name LOG 'Employee number: ', Empno, '; Name: ', Name ENDDO
OpenSTA.org Mailing Lists Further enquiries Documentation feedback CYRANO.com |