Last active
August 29, 2015 14:19
-
-
Save bolilla/78d3997e7f7b2c2d360a to your computer and use it in GitHub Desktop.
GoPadawan MethodMyType
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" | |
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