Go for range construct

The for range construct is useful in many context. It can be used to traverse every item in a collection. It is similar to foreach in other languages. But, we still have the index at each iteration in for range construct.

Syntax:

Go For Range Example

Output:

sum: 60
1 -> mango
2 -> apple
3 -> banana
key: 1
key: 2
key: 3
0 72
1 105

Next TopicGo Goto




Contact US

Email:[email protected]

Go For Range
10/30