Page 1 of 1

multi-statement in zx81 basic?

Posted: Thu Feb 29, 2024 8:56 pm
by msknight
From what I'm reading, I believe that ZX81 doesn't allow multiple commands off the back of one IF THEN statement, but I thought I'd ask here to be sure.

Re: multi-statement in zx81 basic?

Posted: Thu Feb 29, 2024 9:23 pm
by 1024MAK
ZX81 BASIC only allows one command per line. IF being a "special" case, but you can only have one command after the THEN, the THEN being mandatory.

Of course, you can have another IF after the THEN. You can also have a complex expression as part of the IF.

Mark

Re: multi-statement in zx81 basic?

Posted: Thu Feb 29, 2024 9:28 pm
by msknight
Thanks for confirming. Just going to have to write more code :-)

Re: multi-statement in zx81 basic?

Posted: Thu Feb 29, 2024 10:44 pm
by dr beep
msknight wrote: Thu Feb 29, 2024 9:28 pm Thanks for confirming. Just going to have to write more code :-)

Easiest is
IF condition THEN GO SUB linenumber

and at linenumber code mutiple lines and end with RETURN

Re: multi-statement in zx81 basic?

Posted: Thu Feb 29, 2024 10:48 pm
by msknight
Cheers. In my case, it's just two statements so I might as well leave it at that for what I'm doing... but I'll keep that in mind for the future.

Re: multi-statement in zx81 basic?

Posted: Fri Mar 01, 2024 7:28 pm
by GCHarder
Implementing multistatement lines is actually fairly simple, in MC. It's just a matter of keeping track of the chr addresses in the line.

The program "SHREB" from 1986 uses multistatement lines. Since you have a ZXPand you maybe interested in these programs...

https://www.sinclairzxworld.com/viewtop ... =11&t=4739

Greg