my code below is is in a textfield button. The problem is that the val1 to val3 can only be used in one if statement. How can I declare the bars to be used multiple times within that if statement.
if let val1 = Int(a1.text!), let val2 = Int(a2.text!), let val3 = Int(b1.text!)
{
let sum = val1 + val2
let sum2 = val1 + val3
}
if a2.text == "$"{
a1.text = String(sum2)
}
Aucun commentaire:
Enregistrer un commentaire