Skip to content

Instantly share code, notes, and snippets.

@parvezmrobin
Created October 16, 2019 17:35
Show Gist options
  • Save parvezmrobin/970508ea151972ecc0a259f4d69092b0 to your computer and use it in GitHub Desktop.
Save parvezmrobin/970508ea151972ecc0a259f4d69092b0 to your computer and use it in GitHub Desktop.
package main
func main() {
var a = [4]int{1, 2, 3, 4}
var s = a[0:3] // s contains {1, 2, 3}
s[0] = 5
println(s[0], a[0]) // 5 5
s = append(s, 6)
println(s[3], a[3]) // 6 6
s = append(s, 7)
println(s[4]) // 7
s[2] = 8
println(s[2], a[3]) // 8 6
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment