On Saturday, 11 August 2012 at 20:38:33 UTC, bearophile wrote:
bioinfornatics:

n this case why not using a while loop ?

It uses less lines of code, and with the for loop you have a single place where to put the loop variable initialization, test and increment. This makes the code simpler to read. In this case the test is moved inside the loop, but it's better still than a regular while loop.

Bye,
bearophile

What about:

foreach(ushort i; 0..256)
  writefln("%d", cast(ubyte)i);

It may look better than for loop. ("Maybe").

Reply via email to