Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created January 21, 2019 07:39
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 fitomad/c15fd92b327ab624e29ede2413c9565e to your computer and use it in GitHub Desktop.
Save fitomad/c15fd92b327ab624e29ede2413c9565e to your computer and use it in GitHub Desktop.
let numeros = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
let cantidad = numeros.count(where: { $0 % 2 == 0})
print("Hay \(cantidad) números que cumplen con la condición")
// La salida en el terminal es...
// Hay 5 números que cumplen con la condición
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment