In Swift you cannot do math with different types (in this case Int
and Double
). Even Int
and UInt
are not interchangeable.
You have to create new instances of the matching type
var myNumber : Int = 2340
var doubleDiv : Double = Double(myNumber) / 100.0
the decimal places in literals are not necessary in most cases, but it is clearer to use the same signatures.
solved Integer Division (‘Int’ is not convertible to ‘Double’)