This is my first day in Swift programming and till now we are using Objective C. I tried to write simple addition program it works. Like,
var i = 10
var j = 10
var k = i + j
println(k)
But when I change one of the values to float it gives error.
var i = 10
var j = 10.4
var k = i + j
println(k)
Error: main.swift:13:11: Could not find an overload for '+' that accepts the supplied arguments
Now I did Google search and tried few thing e.g. Double(i+j)
, but it doesn't work. Swift should implicitly convert int to float in this case, isn't it?
Please suggest if I am doing any mistake understanding Swift language.