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

Gordon Odame-Adjei
Gordon Odame-Adjei
2,294 Points

Swift Functions & Optionals

Hello There,

I seem to be stuck on this challenge.

I tried the below code in xcode and it worked

func greeting(person: String) {

println("Hello \(person).")

}

greeting("Tom")

Yet when I try to check the code in the Team Treehouse code checker it does not work for some reason.

Where am I going wrong, am I missing something?

Many Thanks

parameters.swift
func greeting(person: String) {

    println("Hello \(person).")
}

greeting("Tom")

You are very close! Don't put the period at the end of the "Hello (person)" thing. Code:

func greeting(person: String) {
    println("Hello \(person)")
}

greeting("Tom")

2 Answers

Xelas got it right. While your code will go through an xcode playground treehouse is looking for code that works and is exactly what they are asking for. Your code would kick out "Hello Tom."

And treehouse wants "Hello Tom"

Annoying but something to keep in mind for future challenges

Gordon Odame-Adjei
Gordon Odame-Adjei
2,294 Points

Thanks very much Alexander and Justin!