diff options
-rw-r--r-- | exercises/maps/maps1/main.go | 16 | ||||
-rw-r--r-- | info.toml | 13 |
2 files changed, 29 insertions, 0 deletions
diff --git a/exercises/maps/maps1/main.go b/exercises/maps/maps1/main.go new file mode 100644 index 0000000..7532d4b --- /dev/null +++ b/exercises/maps/maps1/main.go @@ -0,0 +1,16 @@ +// maps1 +// Make me compile! +// +// I AM NOT DONE +// +package main + +func main() { + // Map with people names and their ages + m := make(map) + + m["John"] = 30 + m["Ana"] = 21 + + fmt.Printf("John is %d and Ana is %d", m[], m[]) +} @@ -179,3 +179,16 @@ name = "slices4" path = "exercises/slices/slices4/main.go" mode = "test" hint = "No hints this time" + +[[exercises]] +name = "maps1" +path = "exercises/maps/maps1/main.go" +mode = "compile" +hint = """ +Maps have types, for the key and the values. + +To make it compile you need to define types. + +Indexing is similar to setting values. + +Check the spec for more info: https://go.dev/ref/spec#Map_types""" |