Am I missing something or typecast is obligatory while adding numbers having different types:
var i:Int=5
var d:Double=6.0
var q:Double= i + d
var w:Double= Double(i) + d
home / developersection / forums / how to typecast obligation is apple swift?
Anonymous User
17-Oct-2014func +(i:Int, d:Double) -> Double {return Double(i) + d
}
let i: Int = 1
let d: Double = 7.0
i + d
// result: 8.0