Skip to content

Instantly share code, notes, and snippets.

@bolilla
Last active August 29, 2015 14:03
Show Gist options
  • Save bolilla/e8a34f7193bba31add25 to your computer and use it in GitHub Desktop.
Save bolilla/e8a34f7193bba31add25 to your computer and use it in GitHub Desktop.
GoPadawan PtrArrSlice Slice Func
package main
import "fmt"
func main() {
var sliceDeTresHastaCuatro = make([]int, 3, 4)
fmt.Println("Este es tu slice al principio, pequeño padawan:", sliceDeTresHastaCuatro)
cambiarPosiciones(sliceDeTresHastaCuatro)
fmt.Println("Este es tu slice al final, pequeño padawan:", sliceDeTresHastaCuatro)
}
func cambiarPosiciones(slice []int) {
fmt.Println("Este es el slice al principio de la función: ", slice)
slice[1] = 42
fmt.Println("Este es el slice al final de la función: ", slice)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment