ref: 2f386b7b411c6fb68748e0a266616efb01675109 a-tour-of-go/basics/structs-slices-maps/1.3.12_nil-slices.go -rw-r--r-- 261 bytes View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
	Notes 1.3.12

	- The zero value of a slice is nil
	- A nil slice has a length and capacity of 0, and has no underlying array
*/

package main

import "fmt"

func main() {
	var s []int
	fmt.Println(s, len(s), cap(s))
	if s == nil {
		fmt.Println("nil!")
	}
}