Key Held?
True if the selected key is held down. Often used in an "if" block to set a condition for an ongoing action that will be repeated as long as the key is held down.
[▼] key held?
is a code block part of the keyboard drawer.
Usage
[▼] key held?
is a type of logic block that returns a boolean. A true is returned if a specific key denoted in the drop down is held down in the current tick.
Syntax
Inputs in this block:
- a keyboard key from drop down
Example
While “Catch Flies!” is toggled on, the up arrow key is held down causing the turtle to move forward. The left arrow key turns the turtle to the left as long as the button is held. Take note that the frog only moves while the key is held down.
Nuances
An important difference between [▼] key held?
and [▼] key typed?
is that [▼] key typed?
returns true only on ticks when the specific key is held AND when it was not held on the previous tick.
Basically, [▼] key typed?
returns true only on the tick when the button is first pushed and not on consecutive ticks. [▼] key held?
returns true forever as long as the specific key is being held down.