E
Elementary Penguin
Shouldn't I be able to do this:
if(1) ++count;
it seems really a pain to have to do
if(1==1) ++count;
if(1) ++count;
it seems really a pain to have to do
if(1==1) ++count;
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Elementary said:Shouldn't I be able to do this:
if(1) ++count;
it seems really a pain to have to do
if(1==1) ++count;

Brian said:Or...
if (true) ++count;
...which is arguably an order of magnitude more readable anyway.
Afterall, I'm still not sure if you wrote the number 1 or the letter l.
Brian
Shouldn't I be able to do this:
if(1) ++count;
it seems really a pain to have to do
if(1==1) ++count;
count++;Willy Denoyette said:Worse? Not at all, if( i = x ) won't even compile as the expression is of
type int and if expects a bool.
Jon Skeet said:No, that's exactly what Daniel was saying. In the kind of situation the
OP was talking about (where if(1) compiles), for instance in C, you get
the type of problem Daniel mentioned.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.