Slide 33
Slide 33 text
You can obtain a section of a slice with the [:] operator.
s := []int{0, 1, 2, 3, 4, 5} // [0, 1, 2, 3, 4, 5]
t := s[1:3] // [1, 2]
t := u[:3] // [0, 1, 2]
t := s[1:] // [1, 2, 3, 4, 5]
t[0] = 42
fmt.Println(s) // [0, 42, 2, 3, 4, 5]
Sub-slicing