🎉 I just finished Day 9 of the #100DaysOfSwiftUI at https://www.hackingwithswift.com/100/swiftui/9
// Lucky numbers using closures
// sorted, filter, map
let luckyNumbers = [7, 4, 38, 21, 16, 15, 12, 33, 31, 49]
print("\n\n======================= Challenge 5")
let _ = luckyNumbers
.filter { !$0.isMultiple(of: 2) }
.sorted()
.map { "\($0) is a lucky number." }
.forEach { print($0) }
No comments:
Post a Comment