+ 2
What does int i = j < 10 ? 5 : 15; mean?
5 Respuestas
+ 10
// similar to
int i;
if (j < 10) i = 5;
else i = 15;
+ 4
It's like a shorter if-else-statement. You wamt to assign a value to the variable i here. The value depends on a statement standing in front of the question mark. If it's true, the first value is assigned (5), if not, the second one (15).
+ 1
good
+ 1
i is 5 and 15
+ 1
and j is 10