+1

Calculator: How to display subtotal when + button is pressed

Cindy 7 years ago updated by icahill (Administrator) 7 years ago 1
Calculator: How would you display the total when the + or - button is pressed instead of the = sign? The proposed scenario would look like this: Press '6' (display 6). Press '+ 7' (display 7) press '+' (display 13). This would eliminate the need for the = button. Note: on the current sample calculator app, if you press '6 + 7+' and then decide to press the = button, it clears out rather than giving the total.
Cindy,

In truth the calculator example we built to demonstrate the concepts of variables and if statements, so it is admittedly not the most advanced wire from a calculator standpoint.

I would need to spend some time updating the tutorial to accomodate for this scenario. It would require you to reevaluate the if statements that occur on the 'operate' action and allow an action similar to 'total' perform an eval statement that captures the [object:ENTRY.text] and saves it as a variable at the correct time and place to use for a new calculation for a new entry.