August 2019
Beginner to intermediate
798 pages
17h 2m
English
This subsection will illustrate the use of the sort.Slice() function, which was first introduced in Go version 1.8. This means that the presented code, which is saved in sortSlice.go, will not run on older Go versions. The program will be presented in three parts. This is the first part:
package main
import (
"fmt"
"sort"
)
type aStructure struct {
person string
height int
weight int
}
Apart from the expected preamble, you can also see the definition of a Go structure for the first time in this book. Chapter 4, The Uses of Composite Types, will thoroughly explore Go structures. For now, bear in mind that structures are types with multiple variables of multiple types.
The second part of sortSlice.go comes ...
Read now
Unlock full access