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

Recap: Functions

Hi guys, I still do not understand how I am supposed to do this task. The task keeps telling me that I have to perform the correct operation of the correct value, while I think that I have done the right operation and the correct value. Can someone help? Thanks.

functions.swift
// Enter your code below
func temperatureInFahrenheit(temperature: Double) -> Double { 
temperature =((temperature*9)/5)+43





}

2 Answers

Hey Han,

The purpose of that function is to take a number as input that represents a given temperature in Celsius and convert that number into another number that represents the same temperature in Fahrenheit. After the conversion, you want to return the Fahrenheit value as the output of the function. Currently, you're not returning anything.

Hi Mikis, I know I am supposed to do that, but I just dont know the code for writing that. Do you have any ideas?

Hey Mikis, I am still stuck on the challenge. This is my code after my edits:

func temperatureInFahrenheit(temperature temperature: Double) -> Double { temperature = ((temperature * 9) / 5) + 43 return temperatureInFahrenheit(temperature: 30.00)

} Now when I check the compiler, it says for me to "Make sure you're performing the correct temperature conversion calculation within the body of the function." But, I only have one constant in the function, and it is "temperature". So, I just can't seem to figure out how I got it wrong because I only have one constant.

Hey Mikis, I am still stuck on the challenge. This is my code after my edits:

func temperatureInFahrenheit(temperature temperature: Double) -> Double { temperature = ((temperature * 9) / 5) + 43 return temperatureInFahrenheit(temperature: 30.00)

} Now when I check the compiler, it says for me to "Make sure you're performing the correct temperature conversion calculation within the body of the function." But, I only have one constant in the function, and it is "temperature". So, I just can't seem to figure out how I got it wrong because I only have one constant.