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

mark hengstebeck
mark hengstebeck
1,119 Points

Recap: functions-step 3 of 3.

How to assign the result of a function to a constant named FahrenheitTemp? Will someone provide me with a hint. // Enter your code below func temperatureInFahrenheit(temperature: Double) -> Double { let temperatureInFahrenheit = temperature * 9 / 5 + 32 return temperatureInFahrenheit } temperatureInFahrenheit(temperature: 24.0)

functions.swift
// Enter your code below
func temperatureInFahrenheit(temperature: Double) -> Double {
let temperatureInFahrenheit = temperature * 9 / 5 + 32
return temperatureInFahrenheit
}
temperatureInFahrenheit(temperature: 24.0)

2 Answers

Stephen Gheysens
Stephen Gheysens
11,935 Points

Hi Mark,

The first problem you're going to encounter is that you're naming the constant and the function the same thing (temperatureInFahrenheit). Without writing it for you, the challenge is looking for something more along the lines of:

func funcName () {
  return val
}

let const = funcName(argument)

Let me know if you have any questions!

Sincerely,

Stephen

mark hengstebeck
mark hengstebeck
1,119 Points

Hi Stephen, That's it! Thanks, Mark