Skip to content

Glossary: Go Basics

len

Also written: length

Built-in function that gives the number of elements in a slice or map, or the number of bytes in a string. The last index of a slice is `len(s)-1`.

Where the book teaches it