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 trialGreg Boiles
748 PointsSwift Functions Challenge Task 1 of 2 (greeting.swift) Don't understand my problem.
Challenge is to declare a function called greeting and use println that outputs "Hello".
I write:
func greeting() {
println("Hello")
}
greeting()
I get this:
Bummer! You shouldn't call println
directly. It needs to be in the body of the function.
What am I doing wrong? To me (a definite newbie) it looks just like what the lesson did. Should I do something like, let message = "Hello" then println(message) ????
func greeting() {
println("Hello")
}
greeting()
1 Answer
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 Pointsfunc greeting(){
println("Hello")
}
You just have to create the function with println statement in the body of it. Don't call the function yet -> w8 4 step 2
Greg Boiles
748 PointsGreg Boiles
748 PointsThank you Nejc. I guess I'm getting ahead of myself.
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 PointsNejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 PointsWelcome. Don't worry I'm the same from time to time. Make sure you read the challange 2 times and always check for typos.
And you'll be up and running full speed.