Skip to content

Instantly share code, notes, and snippets.

@mjard
Forked from sirpengi/blah.go
Last active December 12, 2015 03:18
Show Gist options
  • Save mjard/4705502 to your computer and use it in GitHub Desktop.
Save mjard/4705502 to your computer and use it in GitHub Desktop.
package main
func modify (myarr *[]int) ([]int) {
return append(*myarr, 4)
}
func main() {
arr := []int{}
arr = append(arr, 1)
arr = append(arr, 2)
arr = append(arr, 3)
println(len(arr))
arr = modify(&arr)
println(len(arr))
s := 0
for _, v := range arr {
s = s + v
}
println("Result:", s)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment