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

Srikanth Srinivas
Srikanth Srinivas
1,465 Points

i can't proceed, even though this is correct.

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

thats my code thats supposed to be a custom function that types in the name of a person and adds a greeting "Hello" before their name, although this code is correct, i can't proceed from the challenge and even check the compiler which has no errors. The pop up still says my code could not be compiled though.

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

2 Answers

This quiz is being finicky. Try refreshing and entering your code again. It's correct. Make sure there are no unnecessary lines (shouldn't make a difference, but it did for me).

I think it requires named parameter. Try one of the following:

func greeting(person person: String)

or func greeting(#person: String)

Good luck