Slices

A list of walkers, not just one

So far you've held a single value in a variable β€” one name, one price. A real PawWalk backend deals in lists: every walker near you, every booking in a day, every GPS fix on a route. Go's everyday list type is the slice.

Go has two list-like types, and the difference matters:

  • An array has a fixed length baked into its type: [3]string is exactly three strings, forever. You almost never write these.
  • A slice is a growable view over a run of values: []string β€” note the empty brackets. This is what you actually use, every day.

Coming from Swift, a Go slice is your Array. The fixed [3]string array is the odd one out β€” reach for a slice unless you have a specific reason not to.