2016-03-26 00:47:20 +01:00
# looper block challenges
Coding challenges for the looper.
## Before we get started
Complete the following guided activity:
2016-04-13 17:27:45 +02:00
* [activity ](/lessons/looper/activity )
2016-03-26 00:47:20 +01:00
At the end of the activity, your code should look like this:
```blocks
for (let i = 0; i < 6 ; i + + ) {
basic.showNumber(i)
basic.pause(2000)
}
```
2017-09-07 22:42:08 +02:00
## Challenge 1
2016-03-26 00:47:20 +01:00
What if we want to count up to lucky number 7 instead? Let's do that by changing the ending value to `7` instead of `5` .
```blocks
for (let i = 0; i < 8 ; i + + ) {
basic.showNumber(i)
basic.pause(2000)
}
```
* Run the program now to see your changes.
2017-09-07 22:42:08 +02:00
## Challenge 2
2016-03-26 00:47:20 +01:00
What about 9? Let's do that by changing the ending value to `9` .
```blocks
for (let i = 0; i < 10 ; i + + ) {
basic.showNumber(i)
basic.pause(2000)
}
```
* Run your code to see the new counter.
2017-09-07 22:42:08 +02:00
## Challenge 3
2016-03-26 00:47:20 +01:00
Now let's start counting from `3` instead! Our for loop will always start at `0` so we simply add `3` to the `i` variable when passing it to `show number` .
```blocks
for (let i = 0; i < 10 ; i + + ) {
basic.showNumber(i+3)
basic.pause(2000)
}
```
Run it on the simulator!
2017-09-07 22:42:08 +02:00
## Challenge 4
2016-03-26 00:47:20 +01:00
Now, let's **count down from 9** . Change the line `show number(i + 2, 150)` to `show number(9 - i, 150)` .
```blocks
for (let i = 0; i < 10 ; i + + ) {
basic.showNumber(9-i)
basic.pause(2000)
}
```
* Run the code to make sure it is doing what is expected.
2017-09-07 22:42:08 +02:00
## Challenge 5
2016-03-26 00:47:20 +01:00
After counting down from `9` let's show the string `BOOOM` !