My new favorite D feature

Bob W nospam at aol.com
Thu Dec 21 09:45:01 PST 2006


"Tim Keating" <holyspamster at gmail.com> wrote in message 
news:MPG.1ff2693c84944836989681 at news.digitalmars.com...
> At least for then next couple of hours, anyway:
>
> int i = 100;
>
> if (i = 2);
> {
> writefln("We shouldn't be here");
> }
>
> Yields:
>
> use '{ }' for an empty statement, not a ';'
>

What's wrong with that message?
(I didn't get your joke here - if it was one.)

Removing the ';'  after (i = 2)  should put you in
a better position to get another message:

if (i = 2)
{
    writefln("We shouldn't be here");
}


"Error: '=' does not give a boolean result"

Since you'd probably prefer your program to
actually wotk, you might even want to try this:

if (i == 2)
{
    writefln("We shouldn't be here");
}

But as I mentioned initially - I probably didn't catch
the joke ...






More information about the Digitalmars-d mailing list