you can shorten Add’s parameters list as: (x, y int)
did you consider maybe explaining in the article/chapter why you wrote main with small ‘m’, but Add with capital ‘A’? or actually changing the latter to start with small letter as well?
I’m aware, but IIRC that builtin is something that’s not guaranteed to be in future releases of Go. I want to teach people forward-compatible Go as much as possible.
I think fmt makes for a really great introduction to the notion of “importing” code, as it provides functionality even non-programmers can appreciate, and is just as built-in as println. I don’t see how getting rid of the import would necessarily speed up the user’s first code writing experience, or impart upon them a greater understanding.
(x, y int)
This is similar to what I cover (starting on slide 21) in these slides I created for a session I taught recently: https://docs.google.com/presentation/d/1KTzbHNmbL9BNYJLNLlQavWPMdJflcwVxa57tlEg-aGk/edit#slide=id.g3782c86138_0_217
Note you can do this too:
https://golang.org/pkg/builtin#println
I’m aware, but IIRC that builtin is something that’s not guaranteed to be in future releases of Go. I want to teach people forward-compatible Go as much as possible.
I think
fmt
makes for a really great introduction to the notion of “importing” code, as it provides functionality even non-programmers can appreciate, and is just as built-in asprintln
. I don’t see how getting rid of the import would necessarily speed up the user’s first code writing experience, or impart upon them a greater understanding.