「swift入門」filterの使い方
1.偶数の取得
println([31, 34, 45, 65, 81].filter({(n:Int) -> Bool in return n % 2 == 0}).count)
2.文字列の配列
println([“apple", “orange", “banana", “pear"].filter { $0 != “pear"})
Coding Changes the World
1.偶数の取得
println([31, 34, 45, 65, 81].filter({(n:Int) -> Bool in return n % 2 == 0}).count)
2.文字列の配列
println([“apple", “orange", “banana", “pear"].filter { $0 != “pear"})