Download UBI EasyCoder 201 IIE Programming instructions
Transcript
Chapter 2 Program Instructions ON GOTO Field of Application Statement for conditional branching to one of several lines. Syntax ON<nexp>GOTO<ncon>|<line label>[,<ncon>|<line label>...] <nexp> is a numeric expression that determines which line the program should branch to. <ncon>/<line label> is the number or label of the line, or list of lines, to which the program should branch. Remarks This statement is closely related to the ON GOSUB statement. The nu1meric expression may result in any positive value. The expression is truncated to an integer value before the statement is executed. If the resulting value is negative, 0, or larger than the number of lines, the statement will be ignored. The value of the numeric expression determines which of the lines the program should branch to. For example, if the the value of the numeric expression is 2, the program will branch to the second line in the list. Examples In this example, different texts will be printed on the screen depending on which of the keys 1-3 you press on the keyboard of the host. 10 20 30 1000 1010 2000 2010 3000 3010 INPUT "PRESS KEY 1-3 ", A% ON A% GOTO 1000,2000,3000 END PRINT "You have pressed key 1" GOTO 30 PRINT "You have pressed key 2" GOTO 30 PRINT "You have pressed key 3" GOTO 30 The same example written without line numbers would look like this: IMMEDIATE OFF INPUT "PRESS KEY 1-3 ", A% ON A% GOSUB QQQ,WWW,ZZZ YYY: END QQQ: PRINT "You have pressed key 1" GOTO YYY WWW: PRINT "You have pressed key 2" GOTO YYY ZZZ: PRINT "You have pressed key 3" GOTO YYY IMMEDIATE ON Intermec Fingerprint v7.61 – Programmer’s Reference Manual Ed. 7 179