Homework Solution
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
}
func main() {
f := fibonacci()
for i := 0; i < 10; i++ {
fmt.Println(f())
}
}
Quiz Solutions
1. Goroutines are functions executing in a separate thread and are started with the go keyword.
2. Channels are the main form of synchronization provided by Go. They can be used to send and receive values between goroutines. They are created with the make keyword.
3. The select statement is used to choose a send or receive from a set of channels.