ref: 042d2992a8424c416efdfdbffc68d94e659ae1eb a-tour-of-go/basics/structs-slices-maps/1.3.7_slices.go -rw-r--r-- 382 bytes View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
	Notes 1.3.6

	- A slice is a dynamically-sized, flexible view into the elements of an array
	- Slices are more common than arrays in practice
	- Specify a slice like this: a[low : high]
		It excludes the end (high)
*/

package main

import "fmt"

func main() {
	primes := [6]int{2, 3, 5, 7 , 11, 13}

	var s []int = primes[1:4]	// selects [3, 5, 7] from primes
	fmt.Println(s)
}