Add clarification for else syntax
Rationale: https://github.com/golang/go/issues/5440 else has to be in same line as closing parenthesis. Otherwise people coming from C/C++ would see not so obvious error
This commit is contained in:
parent
82287d9903
commit
fbf17474ce
@ -29,6 +29,8 @@ func main() {
|
||||
} else {
|
||||
fmt.Println(num, "has multiple digits")
|
||||
}
|
||||
// else has to be in same line as closing parenthesis
|
||||
// Moving else to the next line would cause a syntax error
|
||||
}
|
||||
|
||||
// Note that you don't need parentheses around conditions
|
||||
|
Loading…
x
Reference in New Issue
Block a user