Keyboard

These built-in variables will give you information about the keyboard.

key

This built-in variable stores the value of the most recently pressed key. For example, if the user presses 'm', then 'b' :

key will be equal to 'b'

keyIsPressed

This built-in variable has the value True if any key is pressed at the moment. It has the value False otherwise. (Boolean datatype)

keyCode

This built-in variable stores the key code of the last key that was pressed.

Here are some built-in constants that can be used

ENTER = 13
SHIFT = 16
UP_ARROW = 38
DOWN_ARROW = 40
LEFT_ARROW = 37
RIGHT_ARROW = 39

In general, you can search the web for: key code of ### or look at this website.

Find these documents helpful? Let the people who made them help your child learn to code at Strivemath!

We'd love to hear your Feedback/Comments here.

Last updated