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

Stacy Haller
Stacy Haller
1,808 Points

Bumped Back to Task 2

I was on task 3 when I received a notification that task 2 was no longer valid. I input the same code that validated previously, and it is no longer accepted. I receive the message "Bummer! Your result variable has the wrong value in it. Check the task instructions again." I believe my value is correct. Does anyone see what I am doing wrong or is a live update being made to this task?

func greeting(#person: String) -> (language: String, greeting: String) {
let language = "English"
let greeting = "Hello \(person)"

return (language, greeting)
}

var result = greeting(person: "Tom")

3 Answers

I've had this happen several times on other courses. Usually it's not Task Two, but actually something to do with Task Three like punctuation, or something simple that is not letting Task Two complete.

Try removing the Task Three code and running it, then paste it back in to know for sure.

Stacy Haller
Stacy Haller
1,808 Points

@ Lonnie. Thanks. This is exactly what I did, but the code I initially entered no longer works. I type it in Xcode first and copy over so I'm mostly certain there were no changes.

Should your function declaration have #person? That # might be messing with it.

Stacy Haller
Stacy Haller
1,808 Points

Thanks for your help guys. The # just makes person into label. I found another thread on this that I did not see before. For some reason, the answer is not accepted if you write "return (language, greeting)". The parser only accepts "return (greeting, language)". Although both work fine in Xcode.