Standard library / go/types

go/types.Tuple.Len()

Number of variables. Expected stdout: '1\n'.

Formal Syntax & Structure

go syntaxgo
func (t *Tuple) Len() int

Return Value

int

Number of variables.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/types")
func main() {  t := types.NewTuple(types.NewVar(0, nil, "x", types.Typ[types.Int]))  fmt.Println(t.Len())}
Go Reference