Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

On...GoSub is an efficient form of branching based on an index. It compiles as a jump table (as compared to the Case construct which offers comparative functionality, but is compiled as a series of nested If statements).

See also

GoSubGoToLocateOn...GoToReturn

Remarks

Code Block
labels = "LABEL1,LABEL2,LABEL3,LABEL4"
locate input_parm in labels Using "," Setting POS then
  On Pos GoSub LABEL1, LABEL2, LABEL3, LABEL4
end
return
 
LABEL1:
* Code of some type
Return
LABEL2:
* Code of some type
Return
LABEL3:
* Code of some type
Return
LABEL4:
* Code of some type
Return