[OT] Re: DMD 0.165 release
Tom S
h3r3tic at remove.mat.uni.torun.pl
Mon Aug 21 01:32:39 PDT 2006
Ivan Senji wrote:
> 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?
LOL, try this one:
dotimes(10, (writefln("%d %s %f", ++i, new Object, 3.14159f), 0));
More information about the Digitalmars-d-announce
mailing list