Skip to Content
Learn
Structures
Review

Wonderful job, we’ve successfully created our own data type using structures and modeled dogs, books, and birds in our code!

In this lesson, we covered:

  • Structures are a means of modeling real life objects programmatically.
  • How to create a structure using the struct keyword along with properties and methods.
  • Structure properties are used to describe characteristics and values of
  • To model individual objects, we can create instances of structs which may have unique property values.
  • We can access and edit properties using dot notation.
  • If we know that most of our instances will have a specific property value, we can assign default property values inside the struct.
  • Using the init() method allows us to provide an instance with specific values for the structures given properties.
  • Even without an init() method, structs come with a default memberwise initialization method that can assign values to declared properties inside a struct.
  • Structures can have methods that are functions accessible to their instances.
  • Structures are value types, any copied struct that has its properties altered will not affect the original structure from which it was copied.

🙌❗

Instructions

If you want to challenge yourself further:

Folder Icon

Take this course for free

Already have an account?