Navigation:  Reference > Commands >

On Goto/Gosub

Print this Topic Previous pageReturn to chapter overviewNext page

 

Use this command to transfer control to a line label depending on a value.  This is almost like a flat CASE command.

 

ON f/c/e Required - The value to test.  Must resolve to a numeric value.

 

do_what - sacGOTO / GOSUB - Required - GOTO or GOSUB to the appropriate label.

 

label1,label2,...,labelx Required - The list of line labels used to determine where to transfer control.  The first label corresponds to a value of 1, the second to 2, etc.  If the expression resolves to a value of 0 or greater than the number of labels-1 then control is transferred to the last label in the list.  The line labels are separated by commas.

 

EXAMPLE

 

       ON X GOSUB Line1, Line2, Line3, ErrorLine

       

 

SEE ALSO

GOSUB, GOTO

 

 


Page url: http://www.cassoftware.com/tas/manual/ongotogosub.htm