[Next] [Up] [Previous]

The ON Statement

The ON statement has the form:

       ON integer-expression,alt-1,alt-2,alt-3,alt-4,...;alt-por;alt-0 ,alt-(-1),alt-(-2),...;alt-nor

with full freedom, of course, to omit arguments at the end.

The first comma can be @-commented to become @CHOOSE,`, @GOTO,`, or @SELECT,`, but its &'...' replacement is &'CHOOSE' only. The semicolons have the &'...' replacements &'OVER', &'NEGATIVE', and &'UNDER'.

The integer-expression can be any numeric expression capable of being converted to integer form.

Thus,

       ON J,10,20,30

will transfer control to statement 10 if J equals 1, 20 if J equals 2, and 30 if J equals 3. Otherwise, it will fall through to the next statement.

The statement

       ON J,10,20,30;90

transfers control to statements 10, 20, and 30 if J equals 1, 2, or 3 respectively, and also transfers control to statement 90 if J is 4 or more (alt-por: alternative positive out of range). If J is zero or negative, fall-through to the next statement takes place.

The statement

       ON K,210,220,230;;200

transfers control to statements 200, 210, 220, and 230 if J equals 0, 1, 2, or 3 respectively. For any other value of J, fall-through to the next statement takes place.


[Next] [Up] [Previous]