pxt-calliope/docs/lessons/digi-yoyo/quiz-answers.md

36 lines
619 B
Markdown
Raw Normal View History

2016-03-26 00:47:20 +01:00
# digi yoyo quiz answers
Answers for digi yoyo quiz.
This is the answer key for the [digi yoyo quiz](/microbit/lessons/digi-yoyo/quiz).
## 1. Describe what a "while loop" does?
<br/>
A loop that repeats code while a condition is true.
## 2. Write the code that will create a **variable** called `count` and set the variable to 0.
![](/static/mb/lessons/counter-0.png)
<br/>
2016-03-31 00:11:05 +02:00
```blocks
2016-03-26 00:47:20 +01:00
let count = 0
```
## 3. Create a `while loop` that will loop until the **variable** `count` equals 4.
![](/static/mb/lessons/digi-yoyo-0.png)
<br/>
2016-03-31 00:11:05 +02:00
```blocks
let count = 0
2016-03-26 00:47:20 +01:00
while (count < 5) {
count = count + 1
}
```