Skip to content

Instantly share code, notes, and snippets.

@Li-Bot
Last active March 11, 2020 11:13
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/ef85460780cc6c72aef96dccddcdffc8 to your computer and use it in GitHub Desktop.
Save Li-Bot/ef85460780cc6c72aef96dccddcdffc8 to your computer and use it in GitHub Desktop.
// Swift
let colds = fahrenheit.filter { (degreesFahrenheit) -> Bool in
return degreesFahrenheit <= 68.0
}
// For-in loop
var colds = [Double]()
for degreesFahrenheit in fahrenheit {
if degreesFahrenheit <= 68.0 {
colds.append(degreesFahrenheit)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment