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.

enter image description here

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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -