gobasic icon indicating copy to clipboard operation
gobasic copied to clipboard

Support for WHILE/WEND

Open udhos opened this issue 6 years ago • 2 comments

gobasic should support WHILE/WEND.

Documentation: http://www.antonis.de/qbebooks/gwbasman/whilewend.html

$ gobasic while.bas 
Error running program:
	Line 20 : Object{Type:error, Value:The variable 'while' doesn't exist}
$ 
$ more while.bas 
10 let a=1
20 while a<=10
30 print a
40 let a=a+1
50 wend

udhos avatar Jan 25 '19 18:01 udhos

Patches welcome, but I regard this as something I'd not be personally interested in implementing.

In my view simple BASIC uses FOR-loops, and line-numbers. Things like WHILE/WEND is the start of a slippery-slope that ends up supporting "ON ERR GOTO .." and other advanced constructs often those more advanced dialects of BASIC don't even need line-numbers, and allow functions with named-parameters, etc.

Some extensions, and expansions I can be persuaded are useful. (Such as your LET-less assignments, and READing into an array.) But I think there are limits, and whenever I'm unsure I just think back to my ZX Spectrum.

This is a deliberately minimal project, which is a little retro and niche. It won't make all scripts run, or all users happy, and I'm OK with that. It is, after all, just a weekend hack that got a bit bigger because it was fun to play with :)

skx avatar Jan 25 '19 19:01 skx

Of course you should add features only if you find fun in doing so, I fully understand that.

I reported this request for WHILE/WEND because they were present in the old classical BASICA/GW-BASIC dialect for PCs. WHILE/WEND was not a "modern" extension added by things like QBASIC, QuickBasic, VisualBasic, etc.

Have a look at the GW-BASIC manual: http://www.antonis.de/qbebooks/gwbasman/whilewend.html

udhos avatar Jan 25 '19 19:01 udhos