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.
Peter O'Brien
9,348 PointsI can't get the code to run. I get an error message stating I can't run Println directly with or without constant use.
These are the functions I've tried:
func greeting() {
let hi = "Hello"
println(hi)
}
greeting()
func greeting() {
println("Hello")
}
greeting()
Its worth noting that both run fine in Xcode. I am using the Safari browser on Mac.
3 Answers

Ricardo Hill-Henry
38,442 PointsIf you're on the first question, they aren't asking you to call greeting() yet, so just delete that for now. This is all you need for the first task:
func greeting() {
println("Hello")
}

lordcozycat
11,940 PointsAre you trying to call greeting()
in Task 1? You second function is correct, but the Challenge throws that error if you try to call greeting()
outside of Task 2.
Peter O'Brien
9,348 PointsThanks, Bryan. Clearly trying run while the challenge was asking me to walk :-) I don't know how I missed that in the question.
Best, Pete