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 Function Return Types

in Challenge task 2 of 3 of Swift Functions and Optionals - error message given for correct(working) name passing

Challenge task 2 of 3 in Swift Functions and Optionals. Receive message"Bummer, your greeting printed "Hello Tom" when called with "XYZZY" as the parameter. It should have printed "Hello XYZZY". Yet my code (copied & pasted) works within xcode playground.

Jeremy Hayden
Jeremy Hayden
1,740 Points

I may be doing something wrong, but I don't see your code.

4 Answers

Put proper spaces. Sometimes the Treehouse editor just wants spaces properly put and Xcode is fine without it.

Timothy Clark
Timothy Clark
2,383 Points

For some reason the Treehouse editor wants XYZZY instead of Tom.

gökhan sayılgan
gökhan sayılgan
2,285 Points

define your name variable at the out of function , we can call variables in our function that we define before