package main import "fmt" var myArray [5]int var myArrayLiteral = [...]int{1, 2, 3, 3, 5} func main() { fmt.Println(myArray) myArray[0] = 100 fmt.Println(myArray) myArray[len(myArray)-1] = 1000 fmt.Println(myArray) fmt.Println(myArrayLiteral) // iterating through an array for i := 0; i < len(myArrayLiteral); i++ { fmt.Println(myArrayLiteral[i]) } // iterate in reverse for i := len(myArrayLiteral) - 1; i >= 0; i-- { fmt.Println(myArrayLiteral[i]) } // EVEN BETTER for i, v := range myArrayLiteral { fmt.Printf("index: %d, value: %d\n", i, v) } }