Re: loop do .. until end loop is surely incorrect!
- Posted by mattlewis (admin) Feb 28, 2011
- 1440 views
bill said...
while TRUE with entry do integer x = 3 entry ? x end while
Your comments about how it is an error is fine if you reduce everything to jumps and labels.
Of course the code is incorrect.
But my point is that it is incorrect not because it reduces to use before declaration but because at the higher level it is a jump into scope.
The scope inside of the loop is a red herring here. I get that you're uncomfortable with the way the scopes are set out, but you should be able to see that the issue is the jump. Consider this equivalent code:
integer x while TRUE with entry do x = 3 entry ? x end while
Same problem, but x isn't scoped inside the loop.
Matt