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

Aurelio Rosa
Aurelio Rosa
267 Points

Please help me, i have been trying these for yours on my xcode, but it doesn't work at all, can i send my screenshots ?

i can't do the function "print"

kirkbyo
kirkbyo
15,791 Points

Can we see your code, so we can see where you went wrong?

Or can you copy/paste your code in your question?

Amit uses print() and println() in this video.

Do these work for you?

print("Hello")

println("Hello on a new line.")
Aurelio Rosa
Aurelio Rosa
267 Points

// Playground - noun: a place where people can play

import UIKit

var str : String = "Hello "

let modernProggamingLangugage : String = "Swift"

var greeting = str + modernProggamingLangugage //implicit type String or inferred type String

print("To build an iPhone app we need to learn \ (modernProggamingLanguage)")

2 Answers

kirkbyo
kirkbyo
15,791 Points

The reason why you are encountering an error in Xcode playground is because you had a few syntax errors

When you were calling your print statement to print "modernProggamingLangugage", you spelt it differently from when you created it. Also, there is should be no space between your "\" and "(" when doing string interpolation. To fix these errors your print statement should look something like this

print("To build an iPhone app we need to learn \(modernProggamingLangugage)")

Does that answer your questions? :)

Ozzie

Aurelio Rosa
Aurelio Rosa
267 Points

Thanks, i didnt realize that, now it works