ios - Converting string to int for check answer -


for math question app have 2 random numbers generated have 4 buttons answers. want check answer if user pushes right button seems not work.

num1 , num2 labels random numbers generated in technically

num1.text = "(randomnum1)"

and num2.text = "(randomnum2)" thanks.

i have following code under button1 ibaction

    var sum = (num1) + (num2)     if btn1.titlelabel = (sum){             check.text = "right"                 } 

maybe should convert before add num1 , num2. (convert strings integers before adding them up, also, should convert string integer fisrt when comparing sum , btn.titlelabel)


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 -

jquery - javascript onscroll fade same class but with different div -