39 lines
825 B
Markdown
Raw Normal View History

2016-03-25 16:47:20 -07:00
# Reset
Reset the @boardname@ and start the program again.
2016-11-01 17:44:37 -07:00
This function is like pressing the reset button on the back of the @boardname@.
2016-03-25 16:47:20 -07:00
```sig
control.reset()
```
## ~hint
2016-03-25 16:47:20 -07:00
**Simulator**
The **reset** function works only on a real @boardname@ and not in the simulator.
## ~
## Example
This program will count as high as you like when you press button `A`.
When you get tired of counting, press button `B` to reset the
2016-11-01 17:44:37 -07:00
@boardname@ and start the program over.
```blocks
let item = 0;
basic.showNumber(item);
2020-02-20 17:00:11 +01:00
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
item = item + 1;
basic.showNumber(item);
});
2020-02-20 17:00:11 +01:00
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
control.reset();
});
```
## See also
[clear screen](/reference/basic/clear-screen), [game over](/reference/game/game-over)