October 2015
Beginner to intermediate
400 pages
14h 44m
English
There is a lot more to Go than we’ve covered in this quick introduction. Here are some topics we’ve barely touched upon or omitted entirely, with just enough discussion that they will be familiar when they make brief appearances before the full treatment.
Control flow:
We covered the two fundamental control-flow statements,
if and for, but not the switch statement, which is
a multi-way branch. Here’s a small example:
switch coinflip() {
case "heads":
heads++
case "tails":
tails++
default:
fmt.Println("landed on edge!")
}
The result of calling coinflip is compared to the value of each case. Cases are evaluated from top to bottom, so the first matching one is executed. The optional default case ...