pxt-calliope/docs/blocks/loops/while.md
Peli de Halleux fb5bb396e1 more migration to common docs ()
* more migration to common docs

* refactoring js

* removed duplicate docs

* migrating more docs

* more refactoring

* migrated browsers page

* updated summary
2017-03-14 12:07:17 -07:00

341 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--;
    }
})