philnash@programming.dev to JavaScript@programming.devEnglish · 11 months agoStop nesting ternaries in JavaScriptwww.sonarsource.comexternal-linkmessage-square34fedilinkarrow-up143arrow-down110
arrow-up133arrow-down1external-linkStop nesting ternaries in JavaScriptwww.sonarsource.comphilnash@programming.dev to JavaScript@programming.devEnglish · 11 months agomessage-square34fedilink
minus-squareJakenVeina@lemm.eelinkfedilinkarrow-up2·edit-211 months agoYeah, a switch expression is different than a switch statement. I’m not actually sure how many languages actually have them, but in C# its… var output = input switch { null => "Null", 0 => "Zero", > 0 => "Positive", _ => "Negative" };
Yeah, a switch expression is different than a switch statement. I’m not actually sure how many languages actually have them, but in C# its…
var output = input switch { null => "Null", 0 => "Zero", > 0 => "Positive", _ => "Negative" };