Strings, Bytes and Runes in Go
Working with text data is the fundamentals of programming, and understanding how Go handles strings is rather recommended. This post covers strings, bytes and runes in Go, explaining their differences and demonstrating elementary work with them. Strings A string is an immutable sequence of bytes which means we can store there whatever we want, but in most cases it is used to represent sequence of human readable characters. In order to define a string literal we use double quotes like this:...
Zero Values
Golang provides the mechanism to set default values for declared variables. How does it work? When we declare a variable without explicit initialization, Golang will allocate memory for such a variable by setting a zero value for it. var var1 bool var var2 int var var3 float64 var var4 string var var5 *int var var6 []int var var7 map[int]string Let鈥檚 see what values are set for the particular variables listed above:...