It is using calculatorIsOn as a global variable to define if the calculator is on or not and the power button acts as a toggle so if the calc is on when the power is pressed it has to be off, and when it is off it has to be on, so the code is simply toggling the value of calculatorIsOn. The code could be simplified to simply
calculatorIsOn = !calculatorIsOn;
That will make the value true if it is false and false if it is true.