Currently, I'm struggling with this comparison problem and I have been searching for solution for these past three days, but I can't seem to find an answer.
My problem is that I am trying to code the direction of the user's keyboard response. For example, if the user entered three consecutive correct responses the direction would changed to -1 (for down) and for every incorrect response the direction would change to 1 (for up). For every combination of 1 up and 1 down or 1 down and 1 up would constitute one reversal. And so right now I'm having a difficulty in coding one reversal because I don't know how to store the previous direction and then use it and compare with the current direction.
Thank you in advance for any help or advice anyone has to offer.