Javatpoint Logo
Javatpoint Logo

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




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA