On Gosub
Branches in accordance with the specified condition.
On <Expression> Gosub <Label>[,<Label>...]
Parameters
<Expression>
|
The condition expression that controls branching (integer).
|
<Label>
|
Label name for the migration (label).
|
Return Value
None.
Description
The flow of the program processing branches to the subroutine <Label> that corresponds to the value given in <Expression>.
When the value given by the <Expression> is 1, branching is done to the location specified by the 1st <Label>.When it is "n", branching is done to the location specified by the nth <Label>.
When the value given by the <Expression> is 0, or when the <Label> has been omitted, program processing moves to the next line.
When the value given by the <Expression> is 0, or when it has become larger than the number of <Labels>, program processing moves to the next line.
When the value of the <Expression> becomes negative, it becomes an error.
Even when the <Label> of the migration destination does not exist, it will not become an error, and program processing will be moved to the next line.
After the execution of the specified subroutine, processing is returned to the statement following the On Gosub statement by the return statement in the subroutine.
Example
*MEASUREPROC
A&=3
On A& Gosub *A, *B, *C
Return
*A
Print "A"
Return
*B
Print "B"
Return
*C
Print "C"
Return