why ; ?

Tomasz Sowinski tomeksowi at gmail.com
Mon May 5 06:50:15 PDT 2008


Sascha Katzner Wrote:

> An example:
> 
> 	int i
> 	for (i=0; i<10; i++)
> 	writefln(i)
> 
> Should this print all numbers from 1 to 9 or simply increment i ten 
> times and print "10"?

The former. For the latter the it should be 
    for (i=0; i<10; i++) {}
    writefln(i)

btw, can you make a loop without any statement in D? I think no...
Anyway, I don't see the benefit of putting or not putting a semicolon there.



More information about the Digitalmars-d mailing list