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 trialRune Jacobsen
15,650 PointsI don't know what to do. I get the error "You shouldn't call println directly
I get the error you shouldn't println directly. I dont know what i did wrong.
func greeting() {
let hello = "Hello"
println("\(hello)")
}
greeting()
1 Answer
Anthony Babich
5,505 PointsEdit: I looked at what you wrote again and understand what you were looking to do. Although I'm not clear as to why println isn't accepting it. Nevertheless find the answer below.
func greeting() {
println("Hello")
}
greeting()
Rune Jacobsen
15,650 PointsRune Jacobsen
15,650 PointsThanks for the answer! I actually started off doing something similar to this, but didn't call the greeting after the function, which caused it to error, and that was why I tried alternatives. When getting a proper error message I thought it was easier to debug, but all I did was making the function more complicated haha.
Anyway, thanks a lot!