Skip to content

Instantly share code, notes, and snippets.

@bolilla
Created April 18, 2015 10:16
Show Gist options
  • Save bolilla/41a8c953fcf168e70e11 to your computer and use it in GitHub Desktop.
Save bolilla/41a8c953fcf168e70e11 to your computer and use it in GitHub Desktop.
GoPadawan MethodIntArr
package main
import "fmt"
type tresEnteros [3]int
func (x tresEnteros) elDoble() [3]int {
for i, _ := range x {
x[i] = x[i] * 2
}
return x
}
func main() {
var miArray tresEnteros = [3]int{1, 2, 3}
fmt.Println("miArray", miArray)
fmt.Println("y el doble es", miArray.elDoble())
fmt.Println("la variable sigue siendo", miArray)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment