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 Functions and Optionals Optionals Optional Chaining

Besides for the purpose of this video example of Optionals does func sendNoticeto have to be an Int?

Just wondering why it couldn't have been a string so you don't need to use an optional?

1 Answer

Michael Liendo
Michael Liendo
15,326 Points

Exactly, optionals can be of any type. Amit could have easily not used an Int and used a String instead, but I feel he also wanted to introduce the toInt() function as well.

Thank you, I wanted to make sure I wasn't missing anything and I am glad I am actually starting to get it.