Can anyone tell me what the code num1 = (a >= b ? a : b); does?
Specifically the "?" and the ":"
Printable View
Can anyone tell me what the code num1 = (a >= b ? a : b); does?
Specifically the "?" and the ":"
Ternary operator. That statement is equivalent to:Quote:
Originally posted by Aakash Datt
Can anyone tell me what the code num1 = (a >= b ? a : b); does?
Specifically the "?" and the ":"
Code:if (a >= b)
num1 = a;
else
num1 = b;