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 trialRogelio Valdez
6,244 PointsYou should`t call println() directly
It says I should`t call the println() directly, that it should be in the body of the function. Isn't that what I'm already doing?
I am doing this: func greeting() { println("Hello") } greeting()
func greeting() {
println("Hello")
}
greeting()
Rogelio Valdez
6,244 PointsYou're right!! The error was that I wasn't supposed to call the function at this stage. I guess the compiler should show a different warning but it doesn't, anyway... this fixed the problem. Thank You.
1 Answer
Fuad Adetoro
iOS Development Techdegree Student 11,599 PointsDon't call the function just yet. For stage one just create the function and give it the println statement. When you get to stage two you can call the function.
Or... just comment the function greeting being called then uncomment it on stage two.
Ethan Lowry
Courses Plus Student 7,323 PointsEthan Lowry
Courses Plus Student 7,323 PointsWhat you have there looks valid. Does it definitely want you to actually call the function at this stage? If you take that out does it work by any chance?