gobasic
gobasic copied to clipboard
INPUT prompt string should be optional
I think INPUT without prompt string should be supported.
$ more input.bas
10 input a : print a
$
$ gobasic input.bas
Error running program:
Line 10 : ERROR: INPUT should be : INPUT "prompt",var
$
All the versions of BASIC I'm familiar with expect a prompt. For example:
- https://en.wikibooks.org/wiki/BASIC_Programming/Beginning_BASIC/User_Input
I think this is a matter of opinion, because you can receive the same result via:
INPUT "", a
(Plus this avoids confusion if we were ever to allow multiple-inputs. e.g. "INPUT a, b" - does that mean read two input values? Or does it mean print the prompt from variable a, into variable b ?)
In at least this BASIC dialect, the prompt string is optional: http://www.antonis.de/qbebooks/gwbasman/input.html
Also, there are those old games using INPUT with no prompt string:
http://www.vintage-basic.net/bcg/mathdice.bas
520 INPUT T1
According to those games, "INPUT a, b" would mean to collect two numeric variables separated with comma:
10 input a,b: print a"-"b
run
? 2,3
2 - 3
Just for the records, it seems ZX Spectrum supported INPUT without prompt string:
100 REM this polite program remembers your name
110 INPUT n$
120 PRINT "Hello ";n$;"!"
130 GO TO 110
http://www.worldofspectrum.org/ZXBasicManual/zxmanchap2.html