25 lines
467 B
Markdown
Raw Normal View History

2016-03-25 16:47:20 -07:00
# For
### @parent blocks/language
2016-05-20 18:33:31 -07:00
Run part of the program the number of times you say.
2016-03-25 16:47:20 -07:00
2016-05-20 18:33:31 -07:00
### Example: Count to 4
2016-03-25 16:47:20 -07:00
2016-05-20 18:33:31 -07:00
This program will show the numbers 0, 1, 2, 3, and 4 one after another on the LED screen.
2016-03-25 16:47:20 -07:00
2016-05-20 18:33:31 -07:00
```blocks
for(let i = 0; i < 5; ++i) {
basic.showNumber(i)
2016-03-25 16:47:20 -07:00
}
```
### Lessons
2016-04-13 08:27:45 -07:00
[looper](/lessons/looper)
2016-03-25 16:47:20 -07:00
### See also
2016-05-24 12:30:31 -07:00
[repeat](/reference/loops/repeat), [while](/reference/loops/while), [if](/reference/logic/if), [show number](/reference/basic/show-number)
2016-03-25 16:47:20 -07:00