Summary

Completed

In this module, you learned about four data types that will help you better represent the data your programs will use to solve a problem. We started exploring arrays in Go, which, as you noticed, are effortless. And if you've been programming in another language, they're not too different. But you needed to learn how arrays work to understand the other three data types we explored.

For instance, you learned that a slice is a simple data structure with a pointer to an underlying array and two properties to control the length and the capacity of that array. You don't have to worry about a slice's size because Go takes care of "expanding" the size of the underlying array for you. You also learned that the slice operator helps you create new subslices and remove elements from a slice.

Then, we explored maps, which are a data structure similar to slices and arrays. The difference is that a map is composed of a key or value element where the key and values could be of a different type. You also have a built-in function to delete elements from a map quickly. If you try to access a location from a map that doesn't exist, Go doesn't throw a panic error.

Lastly, we explored structs in Go, a data type we'll continue talking about in an upcoming module. A struct is a collection of fields of different types that you could use to represent items from a database. You can also convert structs to a JSON format if you need to do so.

In the upcoming modules, we'll continue using these data types to explore other features in Go.