...

/

Slices of Structures

Slices of Structures

Let’s learn about structure slices in Go.

This lesson shows how to group structures of the same data type and use them as the elements of a slice.

About slices of structures

We can create slices of structures in order to group and handle multiple structures under a single variable name. However, accessing a field of a given structure requires knowing the exact place of the structure in the slice.

For now, have a look at the following figure to better understand how a slice of structures works and how we can access the fields of a specific slice element.

Access this course and 1400+ top-rated courses and projects.