multiple statements per line/long-line statements/editor layout

41 views
Skip to first unread message

Stuart Gillies

unread,
Feb 16, 2021, 7:24:34 AM2/16/21
to Annex WiFi RDS
I'm confused. The Help thing states that multiple statements can be put on the same line. Practice suggests that it doesn't work, odd things happen with no error message (e.g. this subroutine fails: "Daylight:current_mode$="Daylight":gosub paint:return". I realise that it isn't easy to read but I use this format simply to save paper when printing a listing.

Secondly, when e.g. initialising an array it can be necessary to have a long line of values in the DIM statement. Most forms of Basic use the line continuation character (_). But it doesn't seem to work here.

Finally, on a separate matter, is it possible to lock the editor layout so that when I have made it the way I want, using most space for the fields that I use most, it stays that way?  


cicciocb

unread,
Feb 16, 2021, 10:35:32 AM2/16/21
to Annex WiFi RDS
Hi Stuart,
the multiple statements on a single line are not fully supported, in particular does not work when there is a gosub in the line.
I do not support into writing programs with multiple commands per line as this easily generates understandable programs.
So I can only suggest to always write a single command per line, even if this generates longer programs to print.
The line continuation is not supported as well because it would unnecessarily complicate the interpreter

About the editor layout, yes, I already planned to implement something in the future

Dwight

unread,
Feb 16, 2021, 10:44:05 AM2/16/21
to Annex WiFi RDS
Hi Stuart,
I would suggest you at least include spaces before and after each statement in your code.

 "Daylight:current_mode$="Daylight":gosub paint:return"

Daylight:
current_mode$ = "Daylight" : gosub paint : return

something like that.
I am not sure how much memory you are saving by trying to keep everything on one line but I suspect it is minimal as you really are exchanging a NEW LINE for a COLON

Is there a reason you don't want to go the "traditional" route of using separate lines?

at any rate try with the spaces.
Likely Cicciocb will weigh in on this

cheers
Dwight

Stuart Gillies

unread,
Feb 16, 2021, 12:54:22 PM2/16/21
to Annex WiFi RDS
Thanks, that is helpful. Perhaps the help file could be updated? Or a list of exceptions be maintained as a gotcha, as there are a few departures from the help details and I got led down a rat hole before I realised.

As I mentioned, I'm doing multi-statement lines to save paper on frequent printouts. Normally I would use lots of comments, white space, and underlines, but as they remain in the code they use up space. Prior to Annex, my experience was with Picaxe, where code is pre-processed before loading into the interpreter, so comments could be stripped and pretty layout for clarity had no cost. But downloading wasn't OTA so this is much better overall!
Reply all
Reply to author
Forward
0 new messages