First, thanks for this! I recognize that putting a lesson plan together is a lot of work.
In Section 1.11, you're introducing fmt.Println(), and you compare it to C#'s Console.WriteLine(). While the functions perform the same task (output to console), I think it's worth mentioning that fmt.Println() handles the values a bit more nicely.
For example, you have the following text:
The following are equivalent:
Go
C#
But ids is an array, and the golang docs say this:
For compound objects, the elements are printed using these rules, recursively, laid out like this:
struct: {field0 field1 ...}
array, slice: [elem0 elem1 ...]
maps: map[key1:value1 key2:value2 ...]
pointer to above: &{}, &[], &map[]
In short, fmt.Println() will automatically format complex types, like custom objects and arrays. In C#, you need to use a serializer or other formatter; otherwise you'll just get the type name.
First, thanks for this! I recognize that putting a lesson plan together is a lot of work.
In Section 1.11, you're introducing
fmt.Println(), and you compare it to C#'sConsole.WriteLine(). While the functions perform the same task (output to console), I think it's worth mentioning thatfmt.Println()handles the values a bit more nicely.For example, you have the following text:
But
idsis an array, and the golang docs say this:In short,
fmt.Println()will automatically format complex types, like custom objects and arrays. In C#, you need to use a serializer or other formatter; otherwise you'll just get the type name.