This is my code:
print("Please enter your formula:")
let formula = readLine()
if formula == ("[0-9+-*/%]"){
let result = NSExpression(format: formula)
let result1 = result.expressionValue(with: nil, context: nil) as? Int
print("\(result1)")
} else {
print("please type a real formula")
}
My code keeps saying my "format: formula" has problems.
Value of optional type 'String?' must be unwrapped to a value of type 'String'