Here is the code, I'm trying to make a simple calculator :
@IBAction func btnOperatorInput(sender: UIButton) {
let op = ("+", "-", "*", "/")
let nr1 = sender.currentTitle!
var nr2 = ""
if sender.currentTitle == nr1{
display.text! = self.display.text! + nr1
nrTaped = true
} else if sender.currentTitle == String(op) {
nrTaped = false
nr2 = display.text!
display.text! = String(String(nr1) + String(op))
}
for _ in op.0{
self.calc.add(Int(nr1)!, secondNumber: Int(nr2)!)
}
}
I get the error at the for loop. I don't know how to use the "+" (for example) from the String I created, when I press the + to add the numbers together!