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

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,676 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!