2.1.28, initiation update to PXT v5.28.24 (#54)
This commit is contained in:
		
				
					committed by
					
						
						Peli de Halleux
					
				
			
			
				
	
			
			
			
						parent
						
							38a964516e
						
					
				
				
					commit
					5c114a0c57
				
			@@ -1,20 +0,0 @@
 | 
			
		||||
# For
 | 
			
		||||
 | 
			
		||||
### @parent blocks/language
 | 
			
		||||
 
 | 
			
		||||
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) {
 | 
			
		||||
basic.showNumber(i)
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### See also
 | 
			
		||||
 | 
			
		||||
[repeat](/blocks/loops/repeat), [while](/blocks/loops/while), [if](/blocks/logic/if), [show number](/reference/basic/show-number)
 | 
			
		||||
 | 
			
		||||
@@ -1,12 +0,0 @@
 | 
			
		||||
# Repeat
 | 
			
		||||
 | 
			
		||||
Run part of the program the number of times you say.
 | 
			
		||||
 | 
			
		||||
### Block Editor
 | 
			
		||||
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
### See also
 | 
			
		||||
 | 
			
		||||
[for](/blocks/loops/for), [while](/blocks/loops/while), [if](/blocks/logic/if), [show number](/reference/basic/show-number)
 | 
			
		||||
 | 
			
		||||
@@ -1,29 +0,0 @@
 | 
			
		||||
# While
 | 
			
		||||
 | 
			
		||||
Repeat code while a [Boolean](/blocks/logic/boolean) `condition` is true.
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
while(true) {
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
The while loop has a *condition* that evaluates to a [Boolean](/blocks/logic/boolean) value. After the `do` keyword, add the code that you want to run while the `condition` is `true`. The while loop concludes with `end while`.
 | 
			
		||||
 | 
			
		||||
The condition is tested before any code runs. Which means that if the condition is false, the code inside the loop doesn't execute.
 | 
			
		||||
 | 
			
		||||
### 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`).
 | 
			
		||||
 | 
			
		||||
```blocks
 | 
			
		||||
let index = 4;
 | 
			
		||||
while(index >= 0) {
 | 
			
		||||
    led.plot(index, index);
 | 
			
		||||
    index--;
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
### See also
 | 
			
		||||
 | 
			
		||||
[on button pressed](/reference/input/on-button-pressed), [for](/blocks/loops/for), [if](/blocks/logic/if), [forever](/reference/basic/forever)
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user