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 Object-Oriented Swift Class Inheritance Overriding Properties

Patrick McLeod
Patrick McLeod
5,913 Points

Using return vs. print

Hi I think this is a pretty simple question but none the less, I´m still a bit confused regarding when I should use return and when I should use print. I know this question is not directly related to the lesson but I´ve wanted to ask it for a while.

1 Answer

Ian Billings
PLUS
Ian Billings
Courses Plus Student 7,494 Points

Hi Patrick,

I would say in most cases you will use return, as return is more useful than print. Print is useful more in a debugging sense as users cannot see the console when the app is running on their device. When a something is returned from a function is can be stored in a variable/constant and used in another part of your application.

Hope that makes sense