Suggestion for conditional loops
Hi all,
I'd like to suggest a new syntax for conditional loops:
Use "loop" or something similar (rather than "end while") to denote the
end of a conditional loop, also allow conditional loops without a while
statement. So the basic conditional loop would look like:
do
<command_1>
<command_2>
...
loop
rather than currently
while 1 do
<command_1>
<command_2>
...
end while
Then allow a while statement at the beginning *or at the end* of the
loop:
while x < 2 do
<command_1>
<command_2>
...
loop
do
<command_1>
<command_2>
...
loop while x < 2
The advantage is in the last case, where we currently have to write:
while 1 do
<command_1>
<command_2>
...
if x >= 2 then
exit
end if
end while
The problems concerning compatibility are little, we just would have to
replace "end while" with "loop" in existing programs.
But I don't know whether this would require big changes in the parser.
Also, we now always have "end <keyword>" (end if, end for, end function, ...).
Using "do/loop" instead of "while/end while" would introduce an
exception, so I don't know whether this actually ia good idea. But at
least I wanted to tell you for discussion.
Regards,
Juergen
--
Have you read a good program lately?
|
Not Categorized, Please Help
|
|