Hacker News new | past | comments | ask | show | jobs | submit login

What if you write them like this?

  int x = (cond)
     ? 5
     : 1;



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: