Small basic lesson 3 (Mr Evlat)


Identify the 3 names of the variables in these programs
1.
2.
3.
Extension
1 / 16
volgende
Slide 1: Open vraag
ComputingLower Secondary (Key Stage 3)

In deze les zitten 16 slides, met interactieve quizzen, tekstslides en 1 video.

time-iconLesduur is: 50 min

Onderdelen in deze les


Identify the 3 names of the variables in these programs
1.
2.
3.
Extension

Slide 1 - Open vraag

Deze slide heeft geen instructies

Do Now answer
Age
(User input)

Slide 2 - Tekstslide

Deze slide heeft geen instructies

Lesson objectives 

Conquer: Use variables to store values within code.
 
Aspire Higher: Create conditional statements using variables







 
 
Aspire: Create a set of loops to make a program more efficient.

Slide 3 - Tekstslide

Deze slide heeft geen instructies

What is the most suitable variable name to store a users favorite drink.
A
Drink = Coke
B
Food = Coke
C
Variable = Coke`
D
Data = Coke

Slide 4 - Quizvraag

Deze slide heeft geen instructies

What is the purpose of this line of code?

TextWindow.Read()
A
Writes text to screen
B
Saves information
C
Allows the user to enter information
D
Makes the background see through.

Slide 5 - Quizvraag

Deze slide heeft geen instructies

A variable is a method of ....
A
Writing text to screen.
B
Storing information
C
Running you program
D
Searching for Bugs

Slide 6 - Quizvraag

Deze slide heeft geen instructies

If Statements/Conditionals
  • Today we are going to look at a new programming method called if Statements. 

  • If statements use variables and information users enter to make decisions. 
If statements / Conditionals

Slide 7 - Tekstslide

Deze slide heeft geen instructies

Slide 8 - Video

Deze slide heeft geen instructies

If statements
  • We can program the computer to change how it responds using information we give it.

  • Here the response we have changes based on the answer to the question "Is it raining?"

Slide 9 - Tekstslide

Deze slide heeft geen instructies

Slide 10 - Tekstslide

Deze slide heeft geen instructies

Match the programming terms to the code
Variable
If statement
True output
False output

Slide 11 - Sleepvraag

Deze slide heeft geen instructies

Shape Drawing Program


1. Shape selected at start of program and added to variable called "Shape".
2. If shape selected is rectangle run code to draw a rectangle.
Must haves
1. Variable name must match.
2. Code in IF statement needs indentation (space).
3. EndIf to show code in IF statement completed.

Small basic

Slide 12 - Tekstslide

TextWindow.WriteLine("What shape would you like? Square, Rectangle or Triangle?")
Shape = TextWindow.Read()

if Shape = "Rectangle" then
    Turtle.Move(100)
    Turtle.Turn(90)
    Turtle.Move(50)
    Turtle.Turn(90)
    Turtle.Move(100)
    Turtle.Turn(90)
    Turtle.Move(50)
    EndIf
Model Shape Drawing Program

Replicate the code below for drawing a rectangle if selected

  1. Add another if statement for a square option
  2. Add another if statement for a triangle option
Small basic

Slide 13 - Tekstslide

TextWindow.WriteLine("What shape would you like? Square, Rectangle or Triangle?")
Shape = TextWindow.Read()

if Shape = "Rectangle" then
    Turtle.Move(100)
    Turtle.Turn(90)
    Turtle.Move(50)
    Turtle.Turn(90)
    Turtle.Move(100)
    Turtle.Turn(90)
    Turtle.Move(50)
    EndIf
Extension 
Complete 2 additional shapes Hexagon and 

Slide 14 - Tekstslide

Deze slide heeft geen instructies

Why do we need if statements in programming?

Slide 15 - Open vraag

Deze slide heeft geen instructies

Programs like Minecraft need to use If statements so the program can make decisions based on what the user does

For example:

  • If the player walks into lava, then the game takes damage away.
  • If it becomes night, then mobs start to spawn.
  • If the player breaks a block, then the block drops an item.
  • If the hunger bar is low, then the player can’t sprint.

Without If statements, the game wouldn’t react to anything - it would just run in a straight sequence.

If statements allow the game world to change, respond, and behave differently depending on conditions.






Slide 16 - Tekstslide

Deze slide heeft geen instructies