Another simple and fast way is to use:
if inkey$()="w" then print "W pressed"
if inkey$()="5" then print "5 pressed"
if inkey$()="§" then print "§ pressed"
You can use that with letters, characters and numbers but not keys like Enter, CTRL, Backspace etc.
But AFAIK it returns only one key at a time, so when W and D is pressed at the same time, it will only detect the last key pressed.
It's not good for movement or things where you might need to hold 2 or more keys at the same time, but simpler for example trigger buttons like reloading.
There are also some neat functions for the main keys to make the code more readable, like:
if spacekey()=1
if returnkey()=1
if controlkey()=1
if shiftkey()=1
etc.