2 ms·
What if you write them like this? int x = (cond) ? 5 : 1;
by tehjoker 6y ago
What if you write them like this?
int x = (cond)
? 5
: 1;
- bern4444 6y agoI personally prefer int x = (cond) ? 5 : 1; Since the question mark applies to the condition and not the 5. This also highlights the 2 possiblities of the value in a more clear way. The two possible values are directly stacked with nothing in front of them.