OpenSTA logo OpenSTA SCL Reference
DO Command

DO Command

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.

Command Definition:

DO index = value1, value2 {, step}
	command{s}
ENDDO

index

The name of the 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 index variable. This must be either an integer variable or an integer value.

value2

The terminating value of the index 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 index variable is altered 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

<<<
prev page
^^^
section start
>>>
next page