• JakenVeina@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    11 months 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"
    };