philnash@programming.dev to JavaScript@programming.devEnglish · 9 months agoStop nesting ternaries in JavaScriptwww.sonarsource.comexternal-linkmessage-square32fedilinkarrow-up138
arrow-up127external-linkStop nesting ternaries in JavaScriptwww.sonarsource.comphilnash@programming.dev to JavaScript@programming.devEnglish · 9 months agomessage-square32fedilink
minus-squareJakenVeina@lemm.eelinkfedilinkarrow-up2·edit-29 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" };