Quote:
|
Originally Posted by Jay Lundy
The ? : is called the ternary operator. It's a more compact way of doing if statements. The format is:
conditional statement ? statement executed if true : statement executed if false;
I'm assuming that extra 0 stuck in there after hi is a typo?
|
Yea, I was typing kinda/pretty fast then.
Quote:
|
Originally Posted by deltacoder1020
are you sure it's not
Code:
int hi = 0;
return hi ? 1 : 0;
what i've just written is equivalent to this:
Code:
int hi = 0;
if(hi) return 1;
else return 0;
basically, the code means "replace this with b is a is true, otherwise, replace this with c"
|
Thanks, that really clears it up (also thanks to you Jay

).
It might make if-case statements more easier