pxt-calliope/docs/blocks/loops/while.md
Sam El-Husseini e3975e65e5 pxt-microbit Accessibility PR (#529)
* Accessibility changes
2017-09-07 13:42:08 -07:00

340 B

@extends

#examples

Example: diagonal line

The following example uses a while loop to make a diagonal line on the LED screen (points 0, 0, 1, 1, 2, 2, 3, 3, 4, 4).

input.onButtonPressed(Button.A, () => {
    let index = 4;
    while(index >= 0) {
        led.plot(index, index);
        index--;
    }
})