4 ms·
In Rust, a block that ends with an expression without a semicolon returns that expression. It lets you write terse things like let x = if y { a } else { b
by post-it 5y ago
In Rust, a block that ends with an expression without a semicolon returns that expression. It lets you write terse things like
let x = if y { a } else { b }
- NoSorryCannot 5y agoKotlin does the same but without semicolons so it would seem not to be essential.