Update CalculatorBrain.swift

Added an "AC" function, as well as a modulus ("%") function - in the calculator.swift I changed the layout as well, not sure if it was really wanted but got bored
This commit is contained in:
QuantumThom
2019-10-05 00:15:49 -05:00
committed by GitHub
parent e7ea70c42f
commit f7b52740a8

View File

@@ -33,7 +33,9 @@ struct CalculatorBrain {
"÷" : Operation.binary({ $0 / $1 }),
"+" : Operation.binary({ $0 + $1 }),
"" : Operation.binary({ $0 - $1 }),
"=" : Operation.equals
"=" : Operation.equals,
"%" : Operation.binary({$0.truncatingRemainder(dividingBy: $1)}),
"AC" : Operation.constant(0)
]
mutating func performOperation(_ symbol: String) {