Check the museum registry
Before you start this intermediate track
Functions and typed collections. Work with slices, map lookups, and multiple return values.
Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.
Understand it, then try it.
A museum map connects hall names to exhibit counts. A stored count of zero does not mean the hall is missing. Go can return both the value and a presence flag from a map lookup. A missing integer entry returns zero, while the second result tells you whether that key actually exists.
package mainimport "fmt"func main() { halls := map[string]int{"east": 0, "west": 2} count, found := halls["east"] missing, known := halls["roof"] fmt.Printf("%d %t | %d %t\n", count, found, missing, known)}Each mission is a complete independent Go program. Save it as main.go and run go run main.go with Go 1.18 or later. Only the standard fmt package is used.
Track the values line by line. Predict the result before running this example in your own editor.