Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

True, or even:

    Cond1 // if this
      ? Result1 // return this
      : cond2 // else if this
        ? Result2 // return this
        : cond3 // else if this
          ? Result3 // return this
          : ResultElse // else return this


Goodness me that has potential to become something truly hideous.


It's actually not that bad in practice... But I guess the pragmatic formatting is "whatever `prettier` does by default" anyway. :)


It's funny how people have so many different preferences for ternary formatting. I can't think of any other operator that would have tens of different format prefs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: