Hi everyone, I already finished the checkpoint 5 with this solution bellow without warnings in Xcode:
import Cocoa
//CHECKPOINT 5
let luckyNumbers = [7, 4, 38, 21, 16, 15, 12, 33, 31, 49]
let checkPoint5 = { (luckyNumber: [Int]) in
luckyNumber.filter {!($0.isMultiple(of: 2))}
.sorted()
.map { print("\($0) is a lucky number") }
}
checkPoint5(luckyNumbers)
So I tried to put the return Void after the Closure parameter, but I received the follow warning in Xcode: Result of call to 'map' is unused
import Cocoa
//CHECKPOINT 5
let luckyNumbers = [7, 4, 38, 21, 16, 15, 12, 33, 31, 49]
let checkPoint5 = { (luckyNumber: [Int]) -> Void in
luckyNumber.filter {!($0.isMultiple(of: 2))}
.sorted()
.map { print("\($0) is a lucky number") } //the warning is here
}
checkPoint5(luckyNumbers)
I'm just curious, why this happened when I put the Void return? I cant figure out why.