• JakenVeina@lemm.ee
    ·
    edit-2
    1 year 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"
    };