Standard library / go/types

go/types.Array.Len()

Declared array length. Expected stdout: '3\n'.

Formal Syntax & Structure

go syntaxgo
func (a *Array) Len() int64

Return Value

int64

Declared array length.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func main() { t := types.NewArray(types.Typ[types.Int], 3); fmt.Println(t.Len()) }
Go Reference