Loops, functions and data
One loop shape, and many data shapes. These lessons cover for and range, functions with several results, the error as the second one, and pointers. Then come the data the language is built around: arrays, slices with the array behind them, maps with their internals, strings as bytes and as runes, and the fmt verbs that print them. The part ends on structs and methods.
013
Loops, range and labels
the four shapes of for, range over slices, strings, maps and integers, labels, and break outside a loop
Open
014
Functions, several return values and closures
parameters, several results, named results, variadic functions and a closure that captures
Open
015
Errors as values
the error interface, returning an error, errors.New, fmt.Errorf, errors.Is and the nil check
Open
016
Pointers, nil and the address of a value
& and *, new, a pointer field, value against pointer arguments and the nil pointer that panics
Open
017
Arrays and fixed-size buffers
the length in the type, literals, copy and comparison, passing an array, nested arrays and the wrong-size error
Open
018
Slices and the array behind them
make, literals, append, len and cap, subslices as views, a slice over an array and slices.Clone
Open
019
append, capacity and shared backing arrays
the three-word header, growth, the full slice expression, copy, the aliasing bug and make len against cap
Open
020
Maps: lookup, comma-ok and iteration
make and literals, missing keys, comma-ok, delete, random iteration, sorted keys, the nil map and comparable keys
Open
021
Map internals, hashing and growth
buckets, hashing, load factor, growth, the random start of a range and the cost of a lookup
Open
022
Strings, bytes and runes
a string is a byte sequence, indexing, concatenation, strings.Builder and the conversion to []byte and []rune
Open
023
UTF-8, runes and the strings package
runes, UTF-8 widths, len against RuneCountInString, strings.Fields and a word count
Open
024
fmt, verbs and a text table
the verbs, width and precision, Sprintf, Fprintf and a table aligned by the format
Open
025
Structs, literals and anonymous structs
fields, literals, zero values, comparison, anonymous structs and a struct as a map value
Open
026
Methods, value and pointer receivers
methods, value against pointer receivers, the method set, method values and a counter that keeps its state
Open