Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function literals used inline in Go language #671

Merged
merged 3 commits into from
Jul 11, 2014

Conversation

szaydel
Copy link
Contributor

@szaydel szaydel commented Jul 10, 2014

I think this is a feature that is worth showcasing. While the language in my comments may need a good bit of improvement, I think this is an important and useful feature to learn.

fmt.Println("Add + double two numbers: ",
func(a, b int) int {
return (a + b) * 2
}(10, 2)) // Called with args (10, 2)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't mind, change the "Called with args (10, 2)" and make it "Called with args 10 and 2"
Also, could you add a comment: // => ____ where _____ is the output of what this function call with output to the user? Having the output in a comment here will make it much easier to understand what the functions do while reading the doc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do this, definitely. Will do as soon as I have a few moments. Thanks!

@szaydel
Copy link
Contributor Author

szaydel commented Jul 10, 2014

Hopefully this will be a bit better and definitely comment with resulting output makes things more obvious.

@levibostian
Copy link
Collaborator

Wonderful! Thanks again @szaydel

levibostian added a commit that referenced this pull request Jul 11, 2014
Function literals used inline in Go language
@levibostian levibostian merged commit 36dae81 into adambard:master Jul 11, 2014
@szaydel
Copy link
Contributor Author

szaydel commented Jul 12, 2014

Glad to offer a little something. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants