philnash@programming.dev to JavaScript@programming.devEnglish · 11 months agoStop nesting ternaries in JavaScriptwww.sonarsource.comexternal-linkmessage-square31fedilinkarrow-up142arrow-down111
arrow-up131arrow-down1external-linkStop nesting ternaries in JavaScriptwww.sonarsource.comphilnash@programming.dev to JavaScript@programming.devEnglish · 11 months agomessage-square31fedilink
minus-squareJakenVeina@lemm.eelinkfedilinkarrow-up1·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" };