Learn Create Your Own Split Screen

Next Page

Calculators seem like simple things, but their behaviour is actually a lot more complicated than you might think.

We'll just make a very simple calculator. It won't work precisely like a real calculator, but it will be close.

First, we have to recognise that a calculator has to deal with more than just the number shown in it's display. For example, if you key "100 + 32", at the moment the "32" is being displayed, the calculator is also keeping track of the "100".

We need to declare a variable that will keep track of the running result.

var running_result = 0;