Reputation: 37
I'm trying to create a calculator using closures and functions. I got until the actual calculation function which takes in two values, then the user can select which operator to use (addition, multiplication, etc). I don't know how to actually return the value of that calculation.
Upvotes: 1
Views: 47
Reputation: 114783
A closure is, effectively, a function and you simply invoke it as such.
return operator(numberOne:valueOne, numberTwo:valueTwo)
Upvotes: 1