February 2017
Intermediate to advanced
402 pages
8h 7m
English
Zero-initialization is a source of confusion sometimes. They are default values for many types that are assigned even if you don't provide a value for the definition. Following are the zero-initialization for various types:
false initialization for bool type.0 values for int type.0.0 for float type."" (empty strings) for string type.nil keyword for pointers, functions, interfaces, slices, channels and maps.struct for structures without fields.struct for structures with fields. The zero value of a structure is defined as the structure that has its fields initialized as zero value too.Zero-initialization is important when programming in Go because you won't be able to return a ...
Read now
Unlock full access