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