Nil Slices

Learn about nil slices in Go.

Nil slices

Slices don’t have to be checked for nil values and don’t always need to be initialized. Functions such as len, cap, and append work fine on a nil slice:

Get hands-on with 1400+ tech skills courses.