 import UIKit
 
 class ViewController: UIViewController {
+    let zero = "0"
+    let period = "."
+    let plus = "+"
+    let minus = "−"
+    let multiply = "×"
+    let divide = "÷"
+    
     var previousValue: Double?
     var currentValue: Double?
+    var currentOperator: String?
     @IBOutlet weak var resultLabel: UILabel!
     
     required init?(coder aDecoder: NSCoder) {

    }
    
    @IBAction func onEqualsTapped() {
        if let firstValue = previousValue, secondValue = currentValue {
            let solution = firstValue + secondValue
            
            if solution.truncatingRemainder(dividingBy: 1) == 0 {
                resultLabel.text = String(Int(solution))
            } else {
                resultLabel.text = String(solution)
            }
            
            previousValue = solution
            currentValue = nil
        }
    }
}

    }
    
    @IBAction func onPeriodTapped() {
        if let currentText = resultLabel.text where !currentText.contains(period) {
            if previousValue != nil && currentValue == nil {
                resultLabel.text = zero + period
            } else {
                resultLabel.text?.append(period)
            }
            currentValue = Double(currentText)
        }
