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 Basics (retired) Types Printing Results

Jonathan Whelchel
Jonathan Whelchel
2,096 Points

String Interpolation

Seems like this lesson is making it way harder than it should be. What is the point of adding and combining strings within print command when I can just type what I want out instead. Also what is the difference between:

print("To build an app we need to learn + modernProgrammingLanguage")

and

print(To build an app we need to learn (modernProgrammingLanguage)")

the second ones gives the same result and it seems way more complicated

1 Answer

Pavel Fomchenkov
Pavel Fomchenkov
20,897 Points

The + operator just concatenates two strings. When you use interpolation you can use any object that conforms to Printable protocol and you can control this behavior.