2 ms·
> The semicolon turns an expression into an expression statement.[1] And more relevant, this has the effect of suppressing the expression's value when used in
by masklinn 4y ago
> The semicolon turns an expression into an expression statement.[1]
And more relevant, this has the effect of suppressing the expression's value when used in tail position of a block, by moving from the second to the first branch of the block expression grammar: https://doc.rust-lang.org/reference/expressions/block-expr.html https://doc.rust-lang.org/reference/expressions/block-expr.h...
Which also explains why it sometimes doesn't work e.g. in non-block match arms, because they're not blocks, and thus don't accept statements.