ON...GOTO... ============ Function -------- **ON...GOTO...** allows conditional jumping. Syntax ------ ON expression GOTO line number 1, line number 2, ....line number n. Examples -------- :: 10 ON A GOTO100,200,300 20 END | If A=1 then the program will go to line 100 | If A=2 then the program will go to line 200 | If A=3 then the program will go to line 300 If A=1.3 then the program will go to line 100. Remarks ------- ON GOTO will cause program execution to jump to a line number chosen from the list of line numbers positioned immediately after GOTO. The selection of a particular line number in this list is determined by the value of [expression]. The line numbers may themselves be expressions. The value of [expression], in the above example A, is truncated to an integer. It must be noted that the value is truncated to an integer and **NOT** rounded up. So if the above example A=1.9 then the program will go to line 100. If the value of [expression] is zero or greater than number the of line numbers in the list, then program execution Will continue with the next statement. In the above example, if A=4, or A=0 then the program will automatically go to line 20, and the END will be executed. The maximum value of [expression] allowed is 255. If the value of [expression] is greater than 255 then a ’Magnitude Error' will occur and program execution will stop. If in the above example A=256 then an error will occur. A 'Magnitude Error' will also occur if the value of [expression] is negative. Example: :: 10 ON A GOTO 100,200,300: PRINT "HELLO" 20 END If A>3 or A=0 then the program will not go to any of the lines but will immediately print "Hello", and then END will be executed.