Lessons fixes (#1609)
* fixing a bunch of lessons * more fixes * more fixes * more cleanup * Additional fixes
This commit is contained in:
@ -8,25 +8,22 @@ Welcome! This tutorial will teach how to create a counter with a while loop. Let
|
||||
|
||||
## ~
|
||||
|
||||
Create a variable that acts as a counter and set it to 0.
|
||||
Create a variable that acts as a counter and set it to `0`.
|
||||
|
||||
```blocks
|
||||
let count = 0
|
||||
```
|
||||
|
||||
Add a while loop that will loop over and over until the variable `count` equals 10.
|
||||
|
||||
Add a while loop that will loop over and over until the variable ``||variables:count||`` equals `10`.
|
||||
|
||||
```blocks
|
||||
let count = 0
|
||||
while (count < 10) {
|
||||
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Let's add a pause. Then show the value of the the count.
|
||||
|
||||
Let's add a pause. Then show the value of ``||variables:count||``.
|
||||
|
||||
```blocks
|
||||
let count = 0;
|
||||
@ -34,11 +31,9 @@ while (count < 10) {
|
||||
basic.pause(100);
|
||||
basic.showNumber(count)
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Increase the value of count by one.
|
||||
|
||||
Increase the value of ``||variables:count||`` by one.
|
||||
|
||||
```blocks
|
||||
let count = 0
|
||||
@ -49,10 +44,8 @@ while (count < 10) {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## ~avatar avatar
|
||||
|
||||
Excellent, you're ready to continue with the [challenges](/lessons/digi-yoyo/challenges)!
|
||||
|
||||
## ~
|
||||
|
||||
|
@ -19,7 +19,7 @@ while (count < 10) {
|
||||
|
||||
## Challenge 1
|
||||
|
||||
How about we create a counter that counts backwards from 10 to 1? Let's add a while loop that executes only when `count` is greater than 0.
|
||||
How about we create a counter that counts backwards from `10` to `1`? Let's add a while loop that executes only when ``||variables:count||`` is greater than `0`.
|
||||
|
||||
|
||||
```blocks
|
||||
@ -33,19 +33,15 @@ while (count < 10) {
|
||||
while (count > 0) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
## Challenge 2
|
||||
|
||||
Inside of the while loop, let's add `pause->(1000)` so that we have a pause between each number as it's counting down. Also, let's show `count`!
|
||||
|
||||
|
||||
Inside of the while loop, let's add a ``||basic:pause||`` that waits for one seccond so that we have a pause between each number as it's counting down. Also, let's show ``||variables:count||``!
|
||||
|
||||
```blocks
|
||||
let count = 0;
|
||||
let count = 0;
|
||||
while (count < 10) {
|
||||
basic.pause(100);
|
||||
basic.showNumber(count);
|
||||
@ -62,12 +58,11 @@ while (count > 0) {
|
||||
|
||||
## Challenge 3
|
||||
|
||||
Now, we need `count` to decrease by one after the @boardname@ has displayed the value of `count`.
|
||||
Now, we need ``||variables:count||`` to decrease by one after the @boardname@ has displayed the value of ``||variables:count||``.
|
||||
|
||||
We can do this by adding this line:
|
||||
|
||||
```blocks
|
||||
let count = 0;
|
||||
count = count + (count - 1);
|
||||
|
||||
```
|
||||
|
Reference in New Issue
Block a user