Re: loop do .. until end loop is surely incorrect!
- Posted by bill Feb 25, 2011
- 1857 views
loop do ... until <cond> end loop
is misleading in a way that C's
do { ... ) while <cond>
is not. As Kat says until loops like exit when <cond>.
It seems to me that the biggest problem with declaration in loops is not the syntax but declaration combined with with entry (or goto).
Essentially, with entry makes any talk of scope pointless as the entry label can be anywhere in the loop.
As a (perhaps amusing) ilustration:
goto "x" while 0 do "x" ? "I am in a repeat until" end while
prints 'I am in a repeat until'
and a warning: 'statement after goto cannot be reached'.
As while .. end while is a statement I guess you could say this is broken code.
There is little difference between this and:
entry ? "I am in a repeat until" end while