From 28d28eb67f28108e9190e61bcd36487ecdc12a3a Mon Sep 17 00:00:00 2001 From: Ron Hale-Evans Date: Fri, 20 May 2016 18:33:31 -0700 Subject: [PATCH] Rewrite text, code sample. --- docs/reference/loops/for.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/reference/loops/for.md b/docs/reference/loops/for.md index b8ebe9cd..0ecc0d0c 100644 --- a/docs/reference/loops/for.md +++ b/docs/reference/loops/for.md @@ -2,17 +2,15 @@ ### @parent blocks/language -Repeat code a fixed number of times. +Run part of the program the number of times you say. + +### Example: Count to 4 + +This program will show the numbers 0, 1, 2, 3, and 4 one after another on the LED screen. ```blocks for(let i = 0; i < 5; ++i) { -} -``` - -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++) { +basic.showNumber(i) } ``` @@ -22,5 +20,5 @@ for (let k = 0; k < 4; k++) { ### See also -[while](/reference/loops/while), [if](/reference/logic/if) +[while](/reference/loops/while), [if](/reference/logic/if), [show number](/reference/basic/show-number)