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 Syntax and Parameters

Modify the function

Greetings, I don't know what I'm doing wrong.

func greeting (person: str) {
             println ("Hello")

}

2 Answers

Chris Shaw
Chris Shaw
26,676 Points

To answer your original question the challenge won't pass as there is no such type as str in Swift, here are some valid types just to name a few.

  • String
  • Int
  • Double
  • Dictionary

For this challenge you're asked to allow a parameter with a type of String so you should instead have the following.

func greeting (person: String)

It looks like this question was answered here:

https://teamtreehouse.com/forum/using-the-return-type

Those answers are to questions that come after this task.