This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func main() { | |
// This demonstrates the internal of go slice and what happens when slice reaches its capacity and why to be careful when appending to slice | |
// define an array of 5 elements | |
arr := [...]int{1, 2, 3, 4, 5} | |
fmt.Println(arr) // [1 2 3 4 5] |