Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Swift Basics (retired) Types Printing Results

halimat yusuf
halimat yusuf
2,290 Points

Given the constant named language, write a println statement which will print the following string: i'm stuck help i

Given the constant named language, write a println statement which will print the following string: "Learning Swift".

Use the language constant within the string you pass to your println statement. Practice using string interpolation. i've watched the video over and over again but i still don't get it

println.swift
let language = "Swift"
halimat yusuf
halimat yusuf
2,290 Points

thanks but i'm still stuck ' Please practice using string interpolation to use the value of the 'language' constant in the string that is passed to 'println'.' this is what it says

1 Answer

Hi Halimat,

With string interpolation you can merge together strings you want to say the same with something that might be a variable or a constant from elsewhere in your code (say as the result of a function). You could try something like this:

println("Learning \(language)") // this will use whatever you have declared as the language constant.

If xcode complains about println, try print instead - newer versions of swift only allow the latter. If you want to include a new line after your statement you'll need to add the appendNewline parameter.