iOS Functions in Swift Functions in Swift Recap: Functions

Declare a function named temperatureInFahrenheit. The function should take a single input named temperature of type Dou

Declare a function named temperatureInFahrenheit. The function should take a single input named temperature of type Double and has a return type of Double.

func temperatureInFahrenheit(temperature: Double) -> Double { return temperature }

functions.swift
// Enter your code below
KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,163 Points

What you have passes task 1. Are you stuck on task 2?

2 Answers

yes, sir

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,163 Points

Task 2 wants you to add the math for the temperature conversion. You can add this directly to your previous code:

// Enter your code below
func temperatureInFahrenheit(temperature: Double) -> Double {
  return temperature*9/5 + 32 
}