Gaaker Go

Golang Length of arrays

The built-in function len can get the length of an array.

len([3]int{}) // output 3

The following is a complete code example.

package main

import "fmt"

func main() {
	l := len([3]int{})
	fmt.Println(l)
}

Below is the program output:

3
< Length of arrays Length of arrays >