range array golang code example
Example 1: golang range arrat
for i, num := range nums {
if num == 3 {
fmt.Println("index:", i)
}
}
Example 2: range in go
kvs := map[string]string{"a": "apple", "b": "banana"}
for k, v := range kvs {
fmt.Printf("%s -> %s\n", k, v)
}