Last active
August 29, 2015 14:03
-
-
Save bolilla/e8a34f7193bba31add25 to your computer and use it in GitHub Desktop.
GoPadawan PtrArrSlice Slice Func
This file contains 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() { | |
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