Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
tehjoker
on Feb 16, 2021
|
parent
|
context
|
favorite
| on:
Is This a Branch?
What if you write them like this?
int x = (cond) ? 5 : 1;
bern4444
on Feb 16, 2021
[–]
I 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.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: