2016-03-25 16:47:20 -07:00
# On Gesture
2016-06-08 16:59:20 -07:00
Start an [event handler ](/reference/event-handler ) (part of the
program that will run when something happens) This handler works when
2016-11-01 17:44:37 -07:00
you do a **gesture** (like shaking the @boardname @).
2016-03-25 16:47:20 -07:00
```sig
input.onGesture(Gesture.Shake,() => {
})
```
2017-09-07 13:42:08 -07:00
## Parameters
2016-07-15 16:43:26 -07:00
2016-11-01 17:44:37 -07: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-15 16:43:26 -07:00
2017-09-07 13:42:08 -07:00
## Example: random number
2016-03-25 16:47:20 -07:00
2018-08-02 14:49:16 -04:00
This program shows a number from `2` to `9` when you shake the @boardname @.
2016-03-25 16:47:20 -07:00
```blocks
input.onGesture(Gesture.Shake,() => {
2018-08-02 14:49:16 -04:00
let x = Math.randomRange(2, 9)
basic.showNumber(x)
2016-03-25 16:47:20 -07:00
})
```
2019-03-21 07:40:23 -07:00
## See Also
[is gesture ](/reference/input/is-gesture )