GOTO/OF 在 HP 分时 BASIC 中
GOTO/OF in HP Time-Shared BASIC
对于 HP 分时 BASIC 中的以下代码,我想知道第 2270 行:
2180 INPUT X
2190 IF X=1 THEN 2210
2200 LET X=2
2210 LET X=X+1
2220 IF X=3 THEN 2260
2230 IF B>39 THEN 2260
[irrelevant code lines removed for clarity]
2260 X1=X1*(-1)
2270 GOTO X OF 2290,2540,2720
根据此代码库中的其他示例,GOTO [variable] OF [line1,line2,...] 似乎等同于 if X == 1 GOTO LINE 1;如果 X == 2,转到第 2 行,等等
我找到了相关的维基百科位“通过 GOTO/OF 和 GOSUB/OF 语句计算流量控制”,但我想要更清楚。
谁能证实一下?
谢谢,
迦勒
谢天谢地,维基百科页面对所有原始文档都有 link:
http://www.bitsavers.org/pdf/hp/2000TSB/
这包括完整的语言参考:
http://www.bitsavers.org/pdf/hp/2000TSB/22687-90001_AccessBasic9-75.pdf
关于第 11-40 页的 GOTO/OF
GO TO numeric expression OF statement number list
...
When the second form of the GO TO statement is used, the numeric expression is evaluated and rounded to an integer "n". Control then is transferred to the "nth" statement number in the statement number list, where statement number list is one or more statement numbers separated by commas. If there is no statement number corresponding to the value of the numeric expression, the GO TO statement is ignored and the statement following the GO TO statement is executed
这似乎证实了您的猜测
对于 HP 分时 BASIC 中的以下代码,我想知道第 2270 行:
2180 INPUT X
2190 IF X=1 THEN 2210
2200 LET X=2
2210 LET X=X+1
2220 IF X=3 THEN 2260
2230 IF B>39 THEN 2260
[irrelevant code lines removed for clarity]
2260 X1=X1*(-1)
2270 GOTO X OF 2290,2540,2720
根据此代码库中的其他示例,GOTO [variable] OF [line1,line2,...] 似乎等同于 if X == 1 GOTO LINE 1;如果 X == 2,转到第 2 行,等等
我找到了相关的维基百科位“通过 GOTO/OF 和 GOSUB/OF 语句计算流量控制”,但我想要更清楚。
谁能证实一下?
谢谢,
迦勒
谢天谢地,维基百科页面对所有原始文档都有 link:
http://www.bitsavers.org/pdf/hp/2000TSB/
这包括完整的语言参考:
http://www.bitsavers.org/pdf/hp/2000TSB/22687-90001_AccessBasic9-75.pdf
关于第 11-40 页的 GOTO/OF
GO TO numeric expression OF statement number list
...
When the second form of the GO TO statement is used, the numeric expression is evaluated and rounded to an integer "n". Control then is transferred to the "nth" statement number in the statement number list, where statement number list is one or more statement numbers separated by commas. If there is no statement number corresponding to the value of the numeric expression, the GO TO statement is ignored and the statement following the GO TO statement is executed
这似乎证实了您的猜测