|
|
|
|
|
by TwentyPosts
718 days ago
|
|
Speaking from a Rust-perspective, having semicolons at the end of statements makes perfect sense and is a brilliant design decision. Note that I said 'statements', not 'expressions'. A lot of the confusion here (and maybe yours, too) stems from this difference. In Rust, (almost) everything is an expression by default, and you turn it into a statement by adding a semicolon. This allows you (and the type checker) to very neatly distinguish between expressions and statements, which is great. It's a very nice and elegant approach imo. |
|
Personally, I much prefer the design Go uses (where semicolons are implicitly added at the end of newlines following an identifier, numeric or string literal, keyword, or operator).