[swift-users] Why this can't compile

boris uomb at outlook.com
Wed Jun 29 22:03:12 CDT 2016



import Cocoa

var numbers = [12, 14, 15, 21]

// This is OK
numbers.map({
    (number:Int) -> Int in
        let result = 3 * number
        return result
})


// This is OK
numbers.map({
    (number: Int) in
        return 3 * number

})

//Report Error: Ambiguous reference to member ‘map’ 
//    
numbers.map({
    (number: Int) in
        var ret = 3 * number
        return ret
})

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160630/fe31958e/attachment.html>


More information about the swift-users mailing list