OT: for (;;) {} vs while (true) {}

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Fri Nov 25 08:38:57 PST 2016


On Friday, 25 November 2016 at 11:10:44 UTC, Timon Gehr wrote:
> You can just as easily edit the while condition. I use it 
> because "unconditional loop" is less silly than "loop until 
> true is false".

Unconditional loop can be implemented in 3 possible ways :)
1. skip it entirely: since there's no condition to check, can't 
decide if should enter at all
2. run once: since there's no condition to check, can't decide if 
should repeat - becomes just an unconditional block statement
3. infinite loop as if the condition is always true - until it's 
false


More information about the Digitalmars-d mailing list