in reply to Re^3: last in a do while loop
in thread last in a do while loop
There's one significant advantage (from the reader's point of view) to while (1):
-
The meaning of while (1) is straightforward to deduce by someone who has never seen it, whereas the meaning of for (;;) is not.
There are minor advantages (from the reader's point of view) to for (;;):
-
for (;;) has no expression to read, while while (1) does. (Note the addition of loop { ... } in Perl 6.)
-
"(;;)" can be read as "ever". "For ever" sounds better than "while one", "while true" or "while ever" (and requires no mental backtracking). "While not done" would be a great reading, but translating "1" to "not done" is a stretch.
-
for (;;) is visually distinctive from naturally ending loops.
Update: hum... while (!0) could be read as "while not done"...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: last in a do while loop (for (;;))
by Jenda (Abbot) on Nov 04, 2006 at 00:08 UTC | |
Re^5: last in a do while loop (for (;;))
by JimmyDa (Initiate) on Jan 23, 2008 at 16:32 UTC | |
by ikegami (Patriarch) on Jan 23, 2008 at 21:49 UTC | |
by JimmyDa (Initiate) on Jan 25, 2008 at 16:10 UTC | |
by ikegami (Patriarch) on Jan 26, 2008 at 02:32 UTC | |
by rir (Vicar) on Jan 23, 2008 at 17:46 UTC |