gobasic icon indicating copy to clipboard operation
gobasic copied to clipboard

INPUT prompt string should be optional

Open udhos opened this issue 6 years ago • 3 comments

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
$ 

udhos avatar Jan 19 '19 15:01 udhos

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 ?)

skx avatar Jan 19 '19 16:01 skx

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

udhos avatar Jan 19 '19 18:01 udhos

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

udhos avatar Mar 06 '19 17:03 udhos