Reset

Reset the board and start the program again.

This function is like pressing the reset button on the back of the board.

control.reset()

Simulator

The reset function works only on a real board 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 board and start the program over.

let item = 0;
basic.showNumber(item);
input.onButtonPressed(Button.A, () => {
    item = item + 1;
    basic.showNumber(item);
});
input.onButtonPressed(Button.B, () => {
    control.reset();
});

See also

clear screen, game over