slice [ ]
List of dynamic length.
Syntax
name := []type{e1, e2, ...}Description
Slices are the most commonly used in Go (arrays have a fixed size). Elements are accessed by index starting from 0.
Example
Loading editor…
Expected output
red 2
When to use?
Storing lists.