Puzzle 8-12-08 (spoilers)

Wyverex wyverex.cypher at gmail.com
Tue Aug 12 15:22:56 PDT 2008


lurker wrote:
> Wyverex Wrote:
> 
>> 1)First is simple..
>>
>> What's the  "condition" so that the following code
>> snippet  prints both HelloWorld !
>>
>> if  "condition"
>> printf ("Hello");
>> else
>> printf("World");
> 
> Might work, don't know if the order is correct:
> 
> if (!fork())
>     printf ("Hello");
> else
>     printf("World");
> 

if the order is right then I like this answer!

On the web the most accepted solution is the cheater solution


if (!printf("Hello"))
   printf("Hello");
else
   print("World");



More information about the Digitalmars-d-learn mailing list