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 authored and GitHub committed 2019-10-05 00:15:49 -05:00
1 parent e7ea70c42f
commit f7b52740a8
1 file changed
+3 -1
@@ -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) {