"For" infinite loop

bearophile bearophileHUGS at lycos.com
Sun Aug 12 15:53:43 PDT 2012


MattCoder:

> foreach(ushort i; 0..256)
>   writefln("%d", cast(ubyte)i);
>
> It may look better than for loop. ("Maybe").

It looks better. But you every time you use a cast in D you need 
to be careful, because they are like a sharp tool with almost no 
safeties.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list