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

Robert Vazquez
Robert Vazquez
1,782 Points

Return types in a Function in Swift

What else I am missing in this function because I replace the println statement with a return statement but The code doesn't work still please help Thanks

returns.swift
func greeting(person: String) -> String {

      return person      
    }

1 Answer

Jhoan Arango
Jhoan Arango
14,575 Points

Hello Robert:

You are doing good, but the challenge also says that it should return something that says β€œ Hello Tom”

func greeting(person: String) -> String{
    return "Hello \(person)" // Use string interpolation 
}
Robert Vazquez
Robert Vazquez
1,782 Points

thank you Jhoan for helping me out