Initialize arrays with values using a literal:
nums := [5]int{1, 2, 3, 4, 5}
names := [3]string{"Alice", "Bob", "Carol"}
The values go inside braces. You must provide exactly the right number of values, or fewer with the rest being zero values.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Initializing with values
Initialize arrays with values using a literal:
nums := [5]int{1, 2, 3, 4, 5}
names := [3]string{"Alice", "Bob", "Carol"}
The values go inside braces. You must provide exactly the right number of values, or fewer with the rest being zero values.