When ()
when ( v) :: microbit hat
Category micro:bit
Type Hat
Introduced in 3.0

The when () block is a hat block and a micro:bit block. Its options are "moved", "shaken", and "jumped". It activates when the micro:bit is moved, shaken, or jumped, depending on the input.

Example Uses

  • Triggering an event on the micro:bit
when (moved v) :: microbit hat
display text [I've been moved!] :: microbit
  • Triggering an event on the project's stage.
when (moved v) :: microbit hat
change x by (50)
say [I've moved!]

See Also