Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DO WHILE and DO UNTIL
#3
boriel Wrote:I didn't know DO UNTIL... LOOP was allowed in VB, since UNTIL usually is supposed to be at the end.

The DO...LOOP in FreeBASIC allows every possible combination. It's simple, logical and versatile: UNTIL exits when the condition is true, and WHILE exits when the condition is false; their position (after DO or after LOOP) decides whether the first loop will always be executed or not. That feature is what ZX Basic lacks: In ZX Basic the commands inside DO...LOOP always will be executed at least once, unless a surrounding IF...END IF is used.

boriel Wrote:DO WHILE...LOOP can be implemented as WHILE ... END WHILE or WHILE ... WEND.

Of course. I suspect WHILE...END WHILe was added to FreeBASIC for compatibility with QBasic, because it's not needed, but I don't know.

Beta Basic provides the same DO...LOOP than FreeBASIC but no redundant WHILE...END WHILE.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)