3 ms·
Exactly and why I wrote my comment above. I would add the computed goto, as in something like: GOSUB (X * 100) Is really fast, and using switch, or case, or
by ddingus 3y ago
Exactly and why I wrote my comment above.
I would add the computed goto, as in something like:
GOSUB (X * 100)
Is really fast, and using switch, or case, or a set of if, then, else statements can work, but not work well.
There are times when a numeric value works for branching, and having this in BASIC maps directly to assembly language where that sort of thing gets done all the time.
- ikari_pl 3y agoThat's not something the Locomotive BASIC of Amstrad or the C64 basic support, seems like at least these two require a literal line number (probably also because how else would `RENUM` work?)
- ddingus 3y agoTo emulate that feature in a development tool for the Parallax Propeller (FlexSpin), a sequence of labels was used. on X goto a, b, c, d, e, 10000, Fred While not quite the same, the core need is addressed and compiles to a fast jump table. Interestingly, that tool allows one to build programs in SPIN, assembly, C and BASIC. The developer can mix and match at will and it all compiles into an executable image. The Propeller Chip, especially Propler 2, is a literal, embedded playground. Lots of fun.