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

Aftahar Miah
Aftahar Miah
Courses Plus Student 246 Points

Cant complete the challenge. Need help Please

I can't complete the challenge...Im new to all this

let language : string = "Swift"
var str : Learning
println( "str + language")
let language : String = "Swift"
var str = "Learning"
println( "\(str) + \(language)")

Capitalised the S on 'String', Corrected the initialisation of str, Added interpolation to the string you're printing. Hope this helps!

1 Answer

Chris Shaw
Chris Shaw
26,662 Points

Hi Aftahar Miah,

You have a couple of problems with your code which are:

  1. you have given the language constant a type which isn't required by the challenge
  2. you've created a new, but invalid variable called str, this isn't needed and can be omitted
  3. you haven't used string interpolation as shown by Amit in the previous video

With that said the code you should have is as below.

let language = "Swift"
println("Learning \(language)")

And just so it makes sense, if you did want to create a variable called str and assign it a type you need to use camel casing for String and encapsulate Learning within quotes.

var str: String = "Learning"

Happy coding!