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 trial

iOS Swift Functions and Optionals Functions Creating a Function

Evan Eshel
Evan Eshel
7,002 Points

Where am I supposed to put the println command?

I don't understand where it needs to go in order to print the greeting Hello.

1 Answer

Jhoan Arango
Jhoan Arango
14,575 Points

Hey :

Ok so the challenge wants you to create a function, with a println method in it. Remember that when creating a function you have to start with the "func" word, then whatever parameters are required IF any, and a return type.

This challenge does not require parameters nor a return type.

func greeting(){ // NO parameters, and no return type.
println("Hello")

}

// The body of the function, is where you implement it's functionality. 
// So anything that goes in between the curly brackets, is what makes the function work. 
// In this case, it's just a println() method. 

Good luck.