Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Arrays and Slices

Arrays

You can create an array in two ways:

numbers := [5]int{1, 2, 3, 4, 5}
numbers := [...]int{1, 2, 3, 4, 5}

Slices

They are similar to arrays, but you do not specify the size:

array := []int{1, 2, 3, 4, 5}

You can create slices using the built-in function make:

slice := make([]int, 4) // This will create [0 0 0 0]

Test coverage

You can know the coverage of your test using:

go test -cover

More info: https://blog.golang.org/slices-intro