DMD 0.165 release

Ivan Senji ivan.senji_REMOVE_ at _THIS__gmail.com
Mon Aug 21 01:09:50 PDT 2006


Ivan Senji wrote:
> Walter Bright wrote:
>> Tom S wrote:
>>> The supplied example:
>>>
>>> void foo()
>>> {
>>>     int v = 2;
>>>     cond
>>>     (
>>>     scase(v == 1, writefln("it is 1")),
>>>     scase(v == 2, writefln("it is 2")),
>>>     scase(v == 3, writefln("it is 3")),
>>>     scase(true,   writefln("it is the default"))
>>>     );
>>> }
>>>
>>> Gives errors: 'voids have no value'. It works when writefln is 
>>> changed to printf, as it returns an int... It would be cool if voids 
>>> were also allowed to be lazy.
>>
>> That's what I get for changing the code at the last minute. :-(
> 
> :)
> 
> I get voids have no value for the dotimes example on line:
> dotimes(10, writef(x++));
> 

Hmmm, In trying to get the example to work i tried
dotimes(10, (writef(x++),0));

To turn the expression to something other than void but
now it prints:
[int]0[int]1[int]2[int]3[int]4[int]5[int]6[int]7[int]8[int]9
and I can't understand why is this happening?




More information about the Digitalmars-d-announce mailing list