you can check if a key is down and don't need to remember a number, you can just choose which key
but I'm not sure the operation you're talking about is built into mouse/keyboard, however is easy to implement, if you already have events for the keypresses. do you just want to know if they press anything on the keyboard?, or the last key they used that is a set key in your game?
like if they pressed space, which is the fire button down last.
if it's just controls, then in the events that catch the button presses, you just set a global or private variable to whatever control you're in the event for
it's possible to test for any key, but it's more complicated than just making events for specific keys