2016-03-26 00:47:20 +01:00
|
|
|
# Reset
|
|
|
|
|
2016-11-01 18:42:42 +01:00
|
|
|
Reset the @boardname@ and start the program again.
|
2016-06-24 00:25:56 +02:00
|
|
|
|
2016-11-02 01:44:37 +01:00
|
|
|
This function is like pressing the reset button on the back of the @boardname@.
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
```sig
|
|
|
|
control.reset()
|
|
|
|
```
|
2019-12-02 05:58:26 +01:00
|
|
|
## ~hint
|
2016-03-26 00:47:20 +01:00
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
**Simulator**
|
|
|
|
|
|
|
|
The **reset** function works only on a real @boardname@ and not in the simulator.
|
|
|
|
|
|
|
|
## ~
|
|
|
|
|
|
|
|
## Example
|
2016-06-24 00:25:56 +02:00
|
|
|
|
|
|
|
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-02 01:44:37 +01:00
|
|
|
@boardname@ and start the program over.
|
2016-06-24 00:25:56 +02:00
|
|
|
|
|
|
|
```blocks
|
|
|
|
let item = 0;
|
|
|
|
basic.showNumber(item);
|
2023-01-11 18:51:27 +01:00
|
|
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
2016-06-24 00:25:56 +02:00
|
|
|
item = item + 1;
|
|
|
|
basic.showNumber(item);
|
|
|
|
});
|
2023-01-11 18:51:27 +01:00
|
|
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
2016-06-24 00:25:56 +02:00
|
|
|
control.reset();
|
|
|
|
});
|
|
|
|
```
|
|
|
|
|
2019-12-02 05:58:26 +01:00
|
|
|
## See also
|
2016-06-24 00:25:56 +02:00
|
|
|
|
|
|
|
[clear screen](/reference/basic/clear-screen), [game over](/reference/game/game-over)
|