Hi, I have just read some tweets about Sir Sinclair, RIP. And one caught my attention.
It was about a publication about ZX80 and some basic code. It seems that computer could have dynamic gotos
That is, GOTO variable .
It is not possible in Locomotive Basic, I have tried and just got syntax error, or is it possible somehow in Amstrad basic to do it? Just a curiosity.
In the image, lines 110, 121, etc...
In Locomotive Basic there is a much more robust solution for this:
"ON x GOTO" and "ON x GOSUB"
https://www.cpcwiki.eu/index.php/Locomotive_BASIC#ON_variable_GOTO_ln_x1.2C_x2.2C_x3.2C_x4.2C_...
Yeah, the first time you did a RENUM all your calculations would be wrong. ON x GOTO automatically adjusts the destination list to keep pointing at the right places.
You would think that RENUM would parse the listing and change the references?
Quote from: Gryzor on 09:47, 17 September 21
You would think that RENUM would parse the listing and change the references?
RENUM was such a huge help when you had to squeeze in new code in between existing lines. I used it just last year heavily in my game to "organise" the different code areas in a way so I better remember at which line what part starts. Works like a charm even with 30KB of Basic code.
Oh I know, been there. It looked like magic! But the problem exists.
Quote from: Gryzor on 10:04, 17 September 21
Oh I know, been there. It looked like magic! But the problem exists.
which problem?
I remember computed GOTO being one of the two features from other BASICs I most missed in Locomotive BASIC - that and EVAL. I managed to hack EVAL in somehow, but not computed GOTO.
at least for EVAL there was i.e. XBASIC from 1986: https://cpcrulez.fr/applications_coding-xbasic_AI.htm