Jump to content
IGNORED

Skipping commands in multi-statement lines?


ramidavis

Recommended Posts

I wish there was a way to use GOTO to jump to a specific part of a line.
What i mean is, instead of starting with the first command on a line, i wish i could jump past the first (or second, or third etc.) '::'.
For instance,
100 COMMAND#1::COMMAND#2::COMMAND#3::COMMAND#4
Lets say i wanted to jump line 100, but did not want COMMAND#1 to execute.
I would have to write the line as multiple lines, moving COMMAND#1 to a different line.

But lets just suppose there was a way to do what i want.
I imagine it looking something like this:
GOTO ;1 100
The ; and number following it indicate how far into the target line to jump.
Omit it to use GOTO / GOSUB as normal, or specify the number of '::' to be skipped in the target line using ;# syntax (;# could also be a variable like "GOTO ;X 100" where X=2).
Perhaps a future version of RXB could implement something like this?

Link to comment
Share on other sites

Has anybody done a performance review of multiple BASIC statements per line? When I read some of my old BASIC programs, I always wonder why I tried to squeeze that many commands in a single line. Maybe just because I could do it. But it was almost never good for readability.

 

(I admit this is the typical overbearing response in forums, asking whether you actually want that. :-) )

Link to comment
Share on other sites

This is just really asking for BAD PROGRAMMING on purpose.

 

The main argument against spaghetti code is the GOTO and JUMP in Assembly or JMP in GPL.

 

This is the reason for XB use of GOSUB and CALL NAMEHERE so this creates more efficient and better designed code.

 

Which is why GPL has BL or CALL and Assembly has BL and BLWP in the first place.

 

Now agreed line numbers in Basic and XB are a pain but labels in general are no that much better as sequence is much harder to follow with labels vs line numbers.

 

Labels are more convenient to remember then line numbers which is why they are prefered but for human programmers, but at the computers point of view is totally non binary.

 

This is especially true for labels like DSBGYT as only the original programmer know what this stands for, vs 17845 as a line number. (Both are hard to remember)

 

As for multiple code in a XB line you are not forced to use them and could be taken apart so each command or a few command can be on a line.

 

The reason to abandon spaghetti code by programmers started shortly after ADA language was invented, going back would be a really bad design computer science wise.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...