01-03-2023, 07:56 AM
"WHILE... WEND" was the only provided way by GW-BASIC to do loops without relying on "GOSUB/RETURN" and "GOTO".
"DO... LOOP" is superior, I had first seen it in Commodore 128 BASIC, in "RUN" magazine. This game I wanted badly on my Tandy1000HX LOL back in the late 1980's. Some guy wrote a book about programming in QuickBASIC, said "WHILE... WEND" was acceptable and otherwise "GOTO" with clear labels, and "DO... LOOP" was too much like Pascal and he didn't like it. To try to make the older construct more useful "EXIT WHILE" was added. That's why now we also have "EXIT SELECT" which is sloppy also.
QuickBASIC didn't have "EXIT WHILE" nor "_CONTINUE", and therefore the only way to create a "run-once" loop was to employ a "DO... LOOP" that purposely fell through at the end such as "LOOP WHILE 0" or "LOOP UNTIL 1". The idea was to be able to use "EXIT DO" to skip a bunch of lines within the false loop according to a condition. See the Wiki example for "DO... LOOP" which I think was one of the most useful to me.
https://qb64phoenix.com/qb64wiki/index.php/DO...LOOP
(Example #3)
"DO... LOOP" is superior, I had first seen it in Commodore 128 BASIC, in "RUN" magazine. This game I wanted badly on my Tandy1000HX LOL back in the late 1980's. Some guy wrote a book about programming in QuickBASIC, said "WHILE... WEND" was acceptable and otherwise "GOTO" with clear labels, and "DO... LOOP" was too much like Pascal and he didn't like it. To try to make the older construct more useful "EXIT WHILE" was added. That's why now we also have "EXIT SELECT" which is sloppy also.
QuickBASIC didn't have "EXIT WHILE" nor "_CONTINUE", and therefore the only way to create a "run-once" loop was to employ a "DO... LOOP" that purposely fell through at the end such as "LOOP WHILE 0" or "LOOP UNTIL 1". The idea was to be able to use "EXIT DO" to skip a bunch of lines within the false loop according to a condition. See the Wiki example for "DO... LOOP" which I think was one of the most useful to me.
https://qb64phoenix.com/qb64wiki/index.php/DO...LOOP
(Example #3)