2016-03-26 00:47:20 +01:00
# On Gesture
2016-06-09 01:59:20 +02:00
Start an [event handler ](/reference/event-handler ) (part of the
program that will run when something happens) This handler works when
2016-11-02 01:44:37 +01:00
you do a **gesture** (like shaking the @boardname @).
2016-03-26 00:47:20 +01:00
```sig
input.onGesture(Gesture.Shake,() => {
})
```
2017-09-07 22:42:08 +02:00
## Parameters
2016-07-16 01:43:26 +02:00
2016-11-02 01:44:37 +01:00
* ``gesture`` means the way you hold or move the @boardname @. This can be `shake` , `logo up` , `logo down` , `screen up` , `screen down` , `tilt left` , `tilt right` , `free fall` , `3g` , or `6g` .
2016-07-16 01:43:26 +02:00
2017-09-07 22:42:08 +02:00
## Example: random number
2016-03-26 00:47:20 +01:00
2016-11-02 01:44:37 +01:00
This program shows a number from `0` to `9` when you shake the @boardname @.
2016-03-26 00:47:20 +01:00
```blocks
input.onGesture(Gesture.Shake,() => {
2018-04-21 19:52:09 +02:00
let x = Math.randomInt(10)
2016-03-26 00:47:20 +01:00
basic.showNumber(x, 100)
})
```