In the ON ... GOTO statement, the value of expression determines which line number in the list will be used for branching. For example, if the value is 3, the third line number in the list will be destination of the branch. If the value is a non-integer, the fractional portion is rounded.
In the ON ... GOSUB statement, each line number in the list must be the first line number of a subroutine.
If the value of expression is zero or greater than the number of items in the list (but less than or equal to 255), GW-BASIC continues with the next executable statement.
If the value of expression is negative, or greater than 255, an "Illegal function call" error occurs.
100 IF R<1 or R>4 then print "ERROR":END
If the integer value of R is less than 1, or greater than 4, program execution ends.
200 ON R GOTO 150,300,320,390
If R=1, the program goes to line 150.
If R=2, the program branches to line 300 and continues from there. If R=3, the branch will be to line 320, and so on.
All Frank Sinatra recordings, All Beatles albums, All solo albums from John Lennon, Paul McCartney, George Harrison and Ringo Starr, All Beatles songs, List of Platinum selling albums, Database with hits from 1950 to 1999.
Sought after DLL files, Nutworks magazine (retro), Worldwide ISO and TLD codes, File extensions database, The Hackers dictionary, Free software for the Atari, Amiga and Macintosh, Nokia smartphone, PocketPC, List of all BASIC programming language commands, List of all DOS commands, Free Advanced Bash-Scripting Guide (Linux-Unix)