Example: Array in Go
package main
import "fmt"
func main() {
scores := [5]int{100, 92, 88, 95, 75}
fmt.Println("Score", scores)
}
Output:
Score [100 92 88 95 75]
Example: Loop through array in Go
package main
import "fmt"
func main() {
scores := [5]int{100, 92, 88, 95, 75}
for x := 0; x < 5; x++ {
fmt.Println("Score", scores[x])
}
}
Output:
Score 100
Score 92
Score 88
Score 95
Score 75