# jailbreak lesson

break out of a counting loop by pressing button "A".

### @video td/videos/jailbreak-0

## Topic

Break

## Quick Links

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

## Class

Year 7

## Prior learning/place of lesson in scheme of work

Learn how to create a **break**, `break` to exit a while or for loop before the loop is complete. We will be learning how to create a break using global variables, Boolean, If (conditionals), a While Loop as well as simple commands, such as show string, plot image, show number, and pause.

## Documentation

* **Global Variable** : [read more...](/microbit/js/data)
* **Boolean** : [read more...](/microbit/reference/types/boolean)
* **On Button Pressed** : [read more...](/microbit/reference/input/on-button-pressed)
* **While Loop** : [read more...](/microbit/js/while)
* **Break** : [read more...](/microbit/js/break)
* **If (Conditional)** : [read more...](/microbit/reference/logic/if)
* **Show String** : [read more...](/microbit/reference/basic/show-string)
* **Plot Image ** : [read more...](/microbit/reference/led/plot-image)
* **Show Number** : [read more...](/microbit/reference/basic/show-number)
* **Pause** : [read more...](/microbit/reference/basic/pause)

## Objectives

* learn how to create global variables to store data so that you can use it later in your code, functions, and in nested code blocks
* learn how to use the variables to declare a new local Boolean variable that will have one of two possible values: true or false
* learn how to run code when an input button is pressed
* learn how to repeat code while a condition is true
* learn how to exit a while loop before the loop is complete
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to show a string on the LED screen one character at a time
* learn how to turn on LED lights on the LED screen
* learn how to show a number on the LED screen, one digit at a time
* learn how to pause your code for the specified number of milliseconds

## Progression Pathways / Computational Thinking Framework

#### Algorithms

* Designs solutions (algorithms) that use repetition and two-way  selection, ie if, then and else.(AL)
* Uses diagrams to express solutions.(AB)
*  Uses logical reasoning to predict  outputs, showing an awareness of inputs (AL)
* 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)

#### Programming & Development

* Creates programs that implement algorithms to achieve given goals (AL)
*  Declares and assigns variables(AB)
* Uses post-tested loop e.g.‘until’,and a sequence of selection statements in programs,including an if,then and else statement(AL)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB

#### Data & Data Representation

* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
* Defines data types: real numbers and Boolean (AB)

#### Hardware & Processing

* Knows that computers collect data from various input devices, including sensors and application software (AB)

#### 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/jailbreak/tutorial)
* [quiz](/microbit/lessons/jailbreak/quiz)

## Extended Activity

* time: 20 min.
* [challenges](/microbit/lessons/jailbreak/challenges)

## Homework

* Extended Activity: [challenges](/microbit/lessons/jailbreak/challenges)

