ubyte in for loops

bearophile bearophileHUGS at lycos.com
Sat Aug 7 08:04:04 PDT 2010


DBloke:

> The code was
> for(ubyte cnt = 3; cnt > 0; --cnt)
> {
>     ...
>     code here
> }

This program:

import std.stdio: writeln;
void main() {
    for (ubyte i = 3; i > 0; --i) {
        writeln(i);
    }
}

Prints with dmd 2.047:
3
2
1

It's better to use the D.learn newsgroup for such questions.

Bye,
bearophile


More information about the Digitalmars-d-bugs mailing list