If you follow those rules, you will see that this:
if true; { fmt.Println() } else { fmt.Println() }
if true; { fmt.Println(); }; else; { fmt.Println(); };
It used to be that the compiler gave some pretty confusing errors about semi-colons on this, but it seems that's been improved now.
JavaScript has similar semi-colon insertion by the way, but with some different (more confusing) rules.
If you follow those rules, you will see that this:
Will get rewritten to: And that won't work. That's why the braces need to be as "} else {". and "if .. {".It used to be that the compiler gave some pretty confusing errors about semi-colons on this, but it seems that's been improved now.
JavaScript has similar semi-colon insertion by the way, but with some different (more confusing) rules.