21/07/28 18:38:39.95 SAGnL8kO.net
>>455
Note: As a control flow expression, if a block expression is the outer expression of an expression statement, the expected type is () unless it is followed immediately by a semicolon.
URLリンク(doc.rust-lang.org)
An expression that consists of only a block expression or control flow expression, if used in a context where a statement is permitted, can omit the trailing semicolon. This can cause an ambiguity between it being parsed as a standalone statement and as a part of another expression; in this case, it is parsed as a statement. The type of ExpressionWithBlock expressions when used as statements must be the unit type.
When the trailing semicolon is omitted, the result must be type ().
URLリンク(doc.rust-lang.org)
あとif式はifのブロックとelseのブロックで型が揃ってないとだめだよ