42 lines
1.1 KiB
Markdown
42 lines
1.1 KiB
Markdown
# digi yoyo lesson
|
|
|
|
create a counter with a while loop.
|
|
|
|
### @video td/videos/digi-yoyo-0
|
|
|
|
## Topic
|
|
|
|
While Loop
|
|
|
|
## Quick Links
|
|
|
|
* [activity](/microbit/lessons/digi-yoyo/activity)
|
|
* [challenges](/microbit/lessons/digi-yoyo/challenges)
|
|
* [quiz](/microbit/lessons/digi-yoyo/quiz)
|
|
* [quiz answers](/microbit/lessons/digi-yoyo/quiz-answers)
|
|
|
|
## Prior learning/place of lesson in scheme of work
|
|
|
|
Learn how to creating a **while loop**, `while condition do` to repeat code while a condition is true. We will be learning how to create a digi yoyo app using a while loop, a variable, as well as basic commands, such as pause and show number.
|
|
|
|
## Documentation
|
|
|
|
```docs
|
|
let x = 0
|
|
basic.showNumber(0)
|
|
while (true) {
|
|
|
|
basic.pause(20)
|
|
}
|
|
```
|
|
|
|
## Objectives
|
|
|
|
* learn how to create a local variables to store data and use it in your code
|
|
* learn how to set or change the value of a local variable
|
|
* learn how to repeat code while a condition is true
|
|
* learn how a relational comparison (<) of numbers will yield a Boolean
|
|
* learn how to pause your code for the specified number of milliseconds
|
|
* learn how to show a number on the LED screen
|
|
|