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 2.0 Functions Functions in Swift 2.0 Recap: Functions

William Lee
William Lee
1,316 Points

Not sure how to fix my code

I'm having a hard time figuring out what he means by "simply return the value of the temperature parameter from the function"

functions.swift
// Enter your code below
func temperatureInFarenheit(temperature: Double) -> Double {
}

temperatureInFarenheit()

1 Answer

Steven Deutsch
Steven Deutsch
21,046 Points

Hey William Lee,

What the task is telling you to do is to just return the temperature parameter passed in for the time being. You're just setting up your function for use in the next stage. Here's how it should look:

// Enter your code below
func temperatureInFahrenheit(temperature: Double) -> Double {
    return temperature
}

Let me know if you need help with anything other than this for the challenge. Good Luck!

William Lee
William Lee
1,316 Points

Thank you so much! I was initially skeptical of your solution because I typed in return temperature multiple times... and then I realised I mistyped Fahrenheit in my function originally. Christ.