Lesson 1 magic 8 lesson¶
a fortune teller game with the @boardname@.
Topic¶
If (Conditionals)
Quick Links¶
- magic 8 activity
- magic 8 challenges
- magic 8 quiz
- Name
- Directions
- 1. Define what an 'if statement' is.
- 2. Create a Variable called
x
and assign it to a random number between 0 and 2. - 3. Write the 'if statement' to check if
x
is equal to 2. Inside the 'if statement', display the string "Yes". - 4. Write the 'if statement' to check if
x
is equal to 1. Inside the 'if statement', display the string "No." - 5. Write the code to display the string "I don't know" if the Variable
x
is neither 2 nor 1.
- magic 8 quiz answers
- Name
- Directions
- 1. Define what an 'if statement' is.
- 2. Create a Variable called
x
and assign it to a random number between 0 and 2. - 3. Write the 'if statement' to check if
x
is equal to 2. Inside the 'if statement', display the string "Yes". - 4. Write the 'if statement' to check if
x
is equal to 1. Inside the 'if statement', display the string "No." - 5. Write the code to display the string "I don't know" if the Variable
x
is neither 2 nor 1.
Prior learning/place of lesson in scheme of work¶
Learn how to creating conditionals, if condition do
to conditionally run code depending on whether a condition is true or not. We will be learning how to create a fortune telling app using local variable and conditionals (If), input on shake as well as simple commands, such as show string, show number, and clear screen.
Documentation¶
if (true) {}
Math.randomRange(0, 3)
input.onGesture(Gesture.Shake, () => {})
basic.showNumber(7)
basic.clearScreen()
basic.showString("Hello!")
Objectives¶
- learn how to show a string on the LED screen
- learn how to show a number on the LED screen
- learn how to learn how to turn off all the LED lights on the LED screen
- learn how to use the input on shake
- learn how to learn how to create a local variable to store data so that you can use it later in your code
- learn how to learn how to return a random number
- learn how to learn how to conditionally run code depending on whether a condition is true or not