Slices
This is a long section...
Declaration
a[low : high]
a[1 : 4] // a slice includes 1 through 3 of `a`Example
package main
import "fmt"
func main() {
primes := [6]int{2, 3, 5, 7, 11, 13}
var s []int = primes[1:4]
fmt.Println(s)
}Consider Slices as References to Arrays
Example
Slice Literals
Example
Slice Defaults
Example
Slice Length and Capacity
Example
Zero Value
Make a Slice
Example
Slices of Slices
Example (Tic-Tac-Toe board: 2D array)
Append Function
Example
More on Slices
Last updated