David
unread,Nov 15, 2009, 5:46:55 PM11/15/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
From what I've seen, Go doesn't support default function arguments?
Maybe I'm wrong in their implementation...
(I know struct members don't support default values, but I wasn't sure
if functions do).
// the following code doesn't work -- am I implementing something
wrong?
func something(a int, b int, c int = 5) int {
return a + b + c;
}
func main() {
resa := something(1,2,3);
resb := something(1,2);
fmt.Println(resa);
fmt.Println(resb);
}