Migrate docs from the other repo
This commit is contained in:
28
docs/reference/loops/for.md
Normal file
28
docs/reference/loops/for.md
Normal file
@ -0,0 +1,28 @@
|
||||
# For
|
||||
|
||||
Repeat code a preset number of times. #docs #for #endfor #language
|
||||
|
||||
### @parent blocks/language
|
||||
|
||||
|
||||
Repeat code a fixed number of times.
|
||||
|
||||
### Block Editor
|
||||
|
||||

|
||||
|
||||
The Block Editor *for* loop is different than the Touch Develop *for* loop in an important way. The above for loop will iterate *five* times, with the loop variable *i* taking on values 0, 1, 2, 3, and 4. The Touch Develop for loop shown below will iterate four times:
|
||||
|
||||
```
|
||||
for (let k = 0; k < 4; k++) {
|
||||
}
|
||||
```
|
||||
|
||||
### Lessons
|
||||
|
||||
[looper](/microbit/lessons/looper)
|
||||
|
||||
### See also
|
||||
|
||||
[while](/microbit/reference/loops/while), [if](/microbit/blocks/if)
|
||||
|
Reference in New Issue
Block a user