Instantly share code, notes, and snippets.

@fitomad fitomad/swift5_SE-0220.swift Secret
Created Jan 21, 2019

Embed
What would you like to do?
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