Let’s practice what we’ve learned so far in the following exercises. Solutions to these exercises will be provided in the next lesson.
Problem 1
Write a Go program that converts an existing array into a map. For example, let’s assume if we define a 2D array as arr := [][]string{{"key1", "value1"}, {"key2", "value2"}, {"key3", "value3"}}
, our code should output a map ( map[key1:value1 key2:value2 key3:value3]
).
Get hands-on with 1200+ tech skills courses.