logoalt Hacker News

AlienRobot • yesterday at 9:46 PM • 1 reply • view on HN

This is one of the things I like about Rust. You can have both.

    let foo = {
        if bar {
            1
        } else if baz {
            2
        } else {
            3
        }
    };
Unfortunately not all languages are Rust.

Replies

userbinator • yesterday at 10:06 PM

That isn't more concise than

   foo = bar ? 1
             : baz ? 2
                   : 3;
➕ show 1 reply