2 ms·
Yeah, that's my main gripe with Rust as well: the lack of human-readable words ("pub", "fn" and "mut" are abbreviations, not words, and "return" was even abbrev
by rob74 4y ago
Yeah, that's my main gripe with Rust as well: the lack of human-readable words ("pub", "fn" and "mut" are abbreviations, not words, and "return" was even abbreviated to an empty string) and the high density of esoteric special characters.
- ssokolow 4y ago"return" wasn't "abbreviated to an empty string", it's that Rust is expression-oriented, the value of a block is the value of its last expression, adding ; turns expressions into statements, and a function with no terminal expression returns (), which serves the same role as void. fn foo(x: u8) -> u8 { let y = { let z = something(); x + z }; y } TL;DR: It's not a property of the function, it's a property of the curly braces.