Skip to content
masterclass Buddy

Go · Function

len

len returns the size of a Go value according to its type. It counts elements for arrays, slices, and maps; bytes for strings; and queued values for channels.

Last updated

Syntax

func len(v Type) int

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • cap
  • append
  • make
  • copy

Source: builtin package - builtin - Go Packages. Checked 2026-11-03.