Just to check - also a do loop question

12 views
Skip to first unread message

Ronald Hudson

unread,
Nov 7, 2022, 7:29:11 PM11/7/22
to BASIC Anywhere Machine How To
If it runs in qbasic - it should run int BAM?

Also what is the proper way to exit a do ... loop  where there is no while / until test ?

oh btw are all these proper?
do while ... loop
do until ... loop
do ... loop while
do ... loop until

too bad we don't have:
do
   ... multiple statements
while condition  or Until Condition
    ... more multiple statements
loop


Charlie Veniot

unread,
Nov 7, 2022, 8:01:47 PM11/7/22
to BASIC Anywhere Machine How To
G'day,

I think the  Programming Reference has all there is to currently know about BASIC Anywhere Machine.

I'm still focused on getting BAM reasonably compatible with GW-BASIC.  Most of what I've got working for GW-BASIC should be the same for QBasic.  Please refer to the Compatibility with GW-BASIC page.  This is still a work in progress.

As per the documentation (see the BASIC Keywords page), we have:

  • DO /code block/ LOOP WHILE /condition/
  • DO /code block/ LOOP UNTIL /condtion/
  • (The unconditional, loop until some GOTO takes us out of it)  DO /code block/ LOOP
  • WHILE /condition/ /code block/ LOOP
  • WHILE /condition/ /code block/ WEND
  • DO WHILE /condition/ /code block/ LOOP
So different variations there to work with programs from various implementations of BASIC.

I don't recognize the looping structure you mentioned:

do
   ... multiple statements
while condition  or Until Condition
    ... more multiple statements
loop

What BASIC uses that?  (I'm not sure I'd want to support that, unless I see some BASIC examples that show the usefulness of it.

Primary focus now is GW-BASIC compatibility, then QB64/QB64PE. By the end of it, reasonable compatibility with those two should automatically mean reasonable compatibility with QBasic, I think.

Cheers !

Ronald Hudson

unread,
Nov 8, 2022, 2:33:58 AM11/8/22
to BASIC Anywhere Machine How To
do
   ... multiple statements
while condition  or Until Condition
    ... more multiple statements
loop

Is probably equivalent to  "do <statements> if x goto outside <statements> loop" without the need for a label.
I don't know if any language much less some basic has this construct. It could also replace all the others loop constructs.

Thanks tho.  I am not really asking you to implement it, just mentioning it.

Charlie Veniot

unread,
Nov 8, 2022, 2:09:45 PM11/8/22
to BASIC Anywhere Machine How To
The thing that would trip me up pretty quickly, if there's a lot of code between the DO and the LOOP statements, is I'd probably associate the WHILE (or UNTIL) statement with the LOOP statement, and not think about scrolling to find the DO higher up.

Knowing me, I would definitely make some coding errors.

I might do better with the following, but it would still have to be code that all fits on the screen so I can see it all.

do
    ... multiple statements
    while condition  or Until Condition
        ... more multiple statements
    loop
loop

Well, I might be totally misreading what you're expecting from your code template.
Reply all
Reply to author
Forward
0 new messages