Open meleu opened 1 year ago
He mentioned it in the iteration chapter. But yes, it would be nicer if it was introduced in Hello world chapter
The example given in hello world chapter is tricky since the prefix
is defined as a named return parameter
and thus is initialised automatically. However it does talk about an important aspect of when to use named return parameters
as described in https://go.dev/tour/basics/7.
First of all! Huge thank you for this amazing material! I'm new to TDD and Golang and I'm learning a lot! :heart:
As a person who has some years of experience with other programming languages but zero knowledge about Golang, I was a little surprised/confused when I saw statements like these ones:
I googled and learned that we use:
:=
for short variable declarations=
for variable declarations and assignments.In order to prevent people from having to leave the book to research this information, I suggest to put a short explanation about that in the text of the "Hello, World" chapter.
This can be especially enlightening for people coming from some interpreted languages background, where there's no clear difference between "declaration" and "assignment".