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

why do we return values such as strings etc

I'm doing swift and wanted to know, basically why do we return values after the function name in some functions and methods and not in others. ?

theres probably a very simple answer. many thanks

1 Answer

um, because we want some function to return values and other not to. It's just how values are passed around (parameters and return values). A language that didn't work this way would probably have to just store values in some global scope to pass them around. It would be horrible to use, and would have scope implications (it's preferable to have things be somewhat insulated and deliberate). (i hope i understood the question)

Ok thanks Simon .