Open kedarmhaswade opened 6 years ago
What do you mean? From what I know else if
is not a construct in languages, you can put anything after an else and it will get executed, including another if
.
That being said, I think the Tour should also give idomatic go examples, so this would exclude an if/else/if one, quoting the "Effective Go"
It's therefore possible—and idiomatic—to write an if-else-if-else chain as a switch.
On a second note, maybe we can add the if-else-if...
example in the notes of the Switch slide, and state that is recommended to use a switch, or as a code comment.
Context: https://tour.golang.org/flowcontrol/9
It seems that either this slide, or the
If and else
slide should make a mention of theelse if
statement. A first-time reader may get confused by the lack of an explicit mention ofelse if
.