Created
October 26, 2012 21:02
-
-
Save kognate/3961465 to your computer and use it in GitHub Desktop.
go function with returns
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 AThing struct { | |
Public string | |
private int64 | |
} | |
func (a *AThing) ireturn(onearg int64) (int64, error) { | |
// because this is in the same package as the AThing I | |
// can access it's private members | |
iaminferedtype := a.private + onearg; | |
return iaminferedtype, nil | |
} | |
func main() { | |
a := AThing{"hello", 50} | |
b,_ := a.ireturn(50) | |
fmt.Printf("Hai: %d\n",b) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment