Rust part11at TECH
Rust part11 - 暇つぶし2ch467:デフォルトの名無しさん
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のブロックで型が揃ってないとだめだよ


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch