• JakenVeina
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    6 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"
    };