The When () block is a micro:bit block and a Hat block, this block can be found by clicking the extension icon on the bottom left of the editor. The block activates if the button on a micro:bit is moved, shaken, or jumped. It can be used in some interesting ways. For example: if a script says shake the micro:bit, you can shake the micro:bit, and the script will activate.
This block can only be used with a micro:bit.
The block has the following options in the drop-down menu:
Triggering an event on the project's stage.