ios - Integer Division ('Int' is not convertible to 'Double') -
i comming c# , started checking swift ios , got following issue...
i want convert pence amount pounds , finding problem integer division in swift. following error getting.
what can't understand is, works ok in line 38 way same erroring in line 40 when using variable.
edits
decval1 = 23.4 correct. why decval2 can't have same?
in swift cannot math different types (in case int
, double
). int
, uint
not interchangeable.
you have create new instances of matching type
var mynumber : int = 2340 var doublediv : double = double(mynumber) / 100.0
the decimal places in literals not necessary in cases, clearer use same signatures.
Comments
Post a Comment