# die roll lesson create a die on the BBC micro:bit. ## Topic If (Conditionals) ## Quick Links * [activity](/lessons/die-roll/activity) * [challenges](/lessons/die-roll/challenges) * [quiz](/lessons/die-roll/quiz) * [quiz answers](/lessons/die-roll/quiz-answers) * [tutorial](/lessons/die-roll/tutorial) ## Class Year 7 ## Prior learning/place of lesson in scheme of work Learn how to use an if statements to run code run code depending on whether a condition is true or not. We will be learning how to create a die with If statements, On Shake, Variables, Assignment Operator, Pick Random and Show LEDs ## Documentation * **Variables** : [read more...](/reference/variables/var) * **If** : [read more...](/reference/logic/if) * **On Shake** : [read more...](/reference/input/on-gesture) * **Assignment Operator** : [read more...](/reference/variables/assign) * **Math Random** : [read more...](/js/math) * **Show LEDs** : [read more...](/reference/basic/show-leds) ## Objectives * learn how to run code when the BBC micro:bit is shaken, when running code in the web browser, moving the mouse quickly simulates shaking * learn how to create a local variable as a place where you can store and retrieve data * learn how the assignment operator is used to declare a new local variable * learn how to declare a new local variable or update the value of a variable * learn how to return a random number * learn how to conditionally run code depending on whether a condition is true or not * learn how to show an image on the LED screen ## 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) * Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB) * 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) * Understands the difference between, and appropriately uses if and if, then and else statements(AL) * 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 * Understands the difference between data and information(AB) * Uses filters or can perform single criteria searches for information.(AL) * 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) * 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) Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation ## Activity * time: 20 min. * [activity](/lessons/die-roll/activity) * [tutorial](/lessons/die-roll/tutorial) * [quiz](/lessons/die-roll/quiz) ## Extended Activity * time: 20 min. * [challenges](/lessons/die-roll/challenges) ## Homework * Extended Activity: [challenges](/lessons/die-roll/challenges)