KDOC 439: elseブロックでの中括弧は必須ではなかった時代がある
この文書のステータス
- 作成
- 2025-09-16 貴島
- レビュー
- 2025-09-17 貴島
概要
Go 1.0以前の、バージョンr60で elseブロックでの中括弧が必須化された。それ以前は必須でなかった。
Pre-Go 1 Release History - The Go Programming Language
An “else” block is now required to have braces except if the body of the “else” is another “if”. Since gofmt always puts those braces in anyway, gofmt-formatted programs will not be affected. To fix other programs, run gofmt.
関連
- 類推: KDOC 437: map deleteはなかった時代がある。同様のGoの文法仕様の変更例