Quick actions

cmd+k|ctrl+k

Navigation

Languages

Slices / Length and capacity / Essential Go

Snippet info

Language

Go

Visibility

public

Author

kkowalczyk

Created

2019-04-18T17:15:18Z

Updated

2019-04-18T17:15:18Z

package main

import "fmt"

func main() {
	var s = make([]int, 4)
	fmt.Printf("Length:   %d\n", len(s))
	fmt.Printf("Capacity: %d\n", cap(s))
}
INFO