Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Swift Enums and Structs Structs Default Values

Enums & Structs Default values

Why did we create a variable called type in the video? I don't understand the purpose of that in the code or is it supposed to be just an example? Example of what exactly?

Thanks for any help ! :)

1 Answer

Marina Alenskaja
Marina Alenskaja
9,320 Points

Hi! :-)

The reason he created the variable named type, is just to illustrate that the object "Contact" can have multiple properties - first name, last name, and "type" - which means what type of relation it is. It could be a friend, your mom or your dogwalker. It's an example of how complex the objects can be. I hope that makes sense :-)

It totally does make sense now! Thanks Marina for opening it up :)