Good evening I am learning swift 4 and I was caught with this exercise that I can not solve and I have tried hard to solve it and I can not find the solution. help please
I do not see anything wrong with your code.
import Foundation
let ChangeVotes: [Bool] = [true,true,true,false,false,true]
let numTrue = ChangeVotes.filter({$0 == true}).count
let numFalse = ChangeVotes.filter({$0 == false}).count
print("Cantidad true: \(numTrue)")
print("Cantidad false: \(numFalse)")
Print:
Cantidad true: 4
Cantidad false: 2
You can check this by saving this code in a file "file.swift" and running it on your terminal with swift archivo.swift
or link