Golang ProgramsGolang Programs

How to iterate over an Array using for loop?

Create integer array named intArray, with a length of 5. Using a for loop to iterate over the array, display the contents of the array.
package main

import "fmt"

func main() {
	intArray := [5]int{10, 20, 30, 40, 50}
	
	for i := 0; i < len(intArray); i++ {
		fmt.Println(intArray[i])
	}
	
}
golang array