|
|
|
|
|
by cyphar
2850 days ago
|
|
I agree that because of common uses of things like match in Rust it makes it consistent to also do it for functions. I don't agree that the reason why it's consistent is because a function body is an expression (though of course you have more expertise than me on this one -- and Rust does actually treat scopes much more strictly than most other languages so you could argue every scope has the smell of a function call associated with it). |
|
> A function consists of a block, along with a name and a set of parameters.
https://doc.rust-lang.org/reference/expressions/block-expr.h...
> Blocks are always value expressions and evaluate the last expression in value expression context.