Skip to content

Instantly share code, notes, and snippets.

@bolilla
Last active August 29, 2015 14:19
Show Gist options
  • Save bolilla/78d3997e7f7b2c2d360a to your computer and use it in GitHub Desktop.
Save bolilla/78d3997e7f7b2c2d360a to your computer and use it in GitHub Desktop.
GoPadawan MethodMyType
package main
import "fmt"
type nuevoEntero int
func (x nuevoEntero) elDoble() nuevoEntero {
x = x * 2
return x
}
func main() {
var varEntera nuevoEntero = 42
fmt.Println("La respuesta es", varEntera)
fmt.Println("y el doble es", varEntera.elDoble())
fmt.Println("La respuesta sigue siendo", varEntera)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment