Detecting when keys are not pressed

I’ve been working on my first game for the past day, and everything has been going fine until recently. I ran into a problem, and I figured that I could solve it if was able to tell when the player is not pressing any buttons on the keyboard. Unfortunately, I havn’t been able to figure out how to do this. Any help would be appreciated.