# digi yoyo lesson

create a counter with a while loop #while #loop #counter #docs

### @video td/videos/digi-yoyo-0

## Topic

While Loop

## Quick Links

* [tutorial](/microbit/lessons/digi-yoyo/tutorial)
* [quiz](/microbit/lessons/digi-yoyo/quiz)
* [quiz answers](/microbit/lessons/digi-yoyo/quiz-answers)
* [challenges](/microbit/lessons/digi-yoyo/challenges)

## Class

Year 7

## 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

* **local variables** : [read more...](/microbit/reference/variables/var)
* **assignment operator** : [read more...](/microbit/reference/variables/assign)
* **while loop** : [read more...](/microbit/js/while)
* **relational operator ** : [read more...](/microbit/reference/types/number)
* **pause** : [read more...](/microbit/reference/basic/pause)
* **show number** : [read more...](/microbit/reference/basic/show-number)

## 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

## Progression Pathways / Computational Thinking Framework

#### Algorithms

* Uses diagrams to express solutions.(AB)
* Recognises that different solutions exist for the same problem (AL) (AB)  Understands that iteration is the repetition of a process such as a loop (AL)
* Recognises that different algorithms exist for the same problem (AL) (GE)
* Represents solutions using a structured notation (AL) (AB)
*  Can identify similarities and differences in situations and can use these to solve problems (pattern recognition)(GE)

#### Programming & Development

* Creates programs that implement algorithms to achieve given goals (AL)
*  Declares and assigns variables(AB)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Selects the appropriate data types(AL) (AB

#### Data & Data Representation

* Uses filters or can perform single criteria searches for information.(AL)

#### Communication Networks

* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)

#### Information Technology

* Collects, organizes, and presents data and information in digital content (AB)
* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution (EV)
* Recognises ethical issues surrounding the application of information technology beyond school.

Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation

## Activity

* time: 20 min.
* [tutorial](/microbit/lessons/digi-yoyo/tutorial)
* [quiz](/microbit/lessons/digi-yoyo/quiz)

## Extended Activity

* time: 20 min.
* [challenges](/microbit/lessons/digi-yoyo/challenges)

## Homework

* Extended Activity: [challenges](/microbit/lessons/digi-yoyo/challenges)