On…GoTo Command

Evaluates and truncates the expression to an integer. If the resulting value is 0, branches to label0; if 1, branches to label1; and so on.

Syntax

On expression GoTo label0, label1, ...

where the labels are defined by the Label command.

Remarks

If the value is less than 0 or greater than or equal to the number of labels, no branch call is taken and execution continues to the next command. This does not cause an error.

DECLARE iSeg

FOR iSeg = 1 TO 4

ON iSeg GOTO subSeg1, subSeg2, subSeg3, subSeg4

NEXT iSeg

SubSeg1:

'Some code…

SubSeg2:

'Some code…

SubSeg3:

'Some code…

SubSeg4:

'Some code…