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

I'm really stuck in this one part that i can not understand what i'm doing wrong and how to fix it

I'm just not understanding of what I'm doing wrong and how to fix the problem.

println.swift
let language = "Swift"
println("Learning Swift")

1 Answer

Jhoan Arango
Jhoan Arango
14,575 Points

Hey Andrew :

  • Challenge :

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

2) Use the language constant within the string you pass to your println statement. Practice using string interpolation.

Basically they want you to use string interpolation on this challenge. Remember anything that goes in between quotes, the system will take it as strings. So you want to use string interpolation, to tell the system that there is a value in there that it may NOT be of type string, so the system can retrieve that value, and display it as a string.

This is a way to do that.

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

In this case, the system knows now, that there is a value inside "language" and it retrieves it and displays the value as a string too.

So even if it was an integer, it will show as a String.

Hope this helps

Good luck.