News for hackers. Stuff that matters.
Re:Rust for JavaScript Developers – Functions and Control Flow by mekkkkkk on Monday July 06, 2020 @06:13AM (#23746297)
I've come to hesistently accept nested ternaries, but I try to have all lines lead with a colon. This kinda mimics a switch statement with returns.

  firstPossible ? thenThis
    : secondPossible ? thenThisOtherThing
    : thirdPossible ? thenThisThirdThing
    : defaultThing
Always fun to see how people treat ternary nesting. They still feel a bit naughty to me. The terseness is sort of unbeatable though.
Re:Rust for JavaScript Developers – Functions and Control Flow by Kkoala on Monday July 06, 2020 @08:48AM (#23747296)
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.