11
you are viewing a single comment's thread
view the rest of the comments
[-] JakenVeina@lemm.ee 2 points 2 years ago* (last edited 2 years ago)

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"
};
this post was submitted on 11 Dec 2023
11 points (86.7% liked)

JavaScript

2786 readers
1 users here now

founded 3 years ago
MODERATORS