🚀 Get 25% off access to all my premium courses - use discount code FUNCMAIN at checkout - view the pricing page now!

Looping Over Array in Go Image Looping Over Array in Go

In this code snippet, we are going to take a look at how you can quickly iterate over an array of type strings in Go.

We’ll use the range keyword to allow us to iterate over the scientists array that we have created. This will return 2 values, the first will be the index, the second is the value.

In this instance we ignore the index returned by utilizing an _ in its place. We then print out the value within the body of our for loop.

Further Reading:

If you found this useful, then you may also enjoy these other articles on the site: