Skip to content

Instantly share code, notes, and snippets.

@Li-Bot
Last active March 11, 2020 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Li-Bot/2a58d53391dfbd4eb07eeebe85f3bfa6 to your computer and use it in GitHub Desktop.
Save Li-Bot/2a58d53391dfbd4eb07eeebe85f3bfa6 to your computer and use it in GitHub Desktop.
// Swift
let celsius = fahrenheit.map { (degreesFahrenheit) -> Double in
return (degreesFahrenheit - 32.0) / 1.8
}
// For-in loop
var celsius = [Double]()
for degreesFahrenheit in fahrenheit {
celsius.append((degreesFahrenheit - 32.0) / 1.8)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment