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 trialEarnie Eng
159 Pointscannot complete first Swift function challenge even if done correctly
The error checker does not work. It warns me that I need to enclose the println function inside a function, which I did.
func greeting() {
println("Hello")
}
greeting()
2 Answers
Sara Chicazul
7,475 PointsIf this error is happening on the first task, it's probably because you've added the line to call the function afterward. The error checker can be very literal and you can get errors if you add any more code than the question asked for!
Jared Watkins
10,756 PointsSara is right.
You have to complete the challenge tasks in order. You can't just put in the finished code on task one or else you get the error " Bummer! You shouldn't call println
directly. It needs to be in the body of the function.".
This can also crash and cause the page to need to be reloaded.