Small basic lesson 3 (Mr Evlat)


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

This lesson contains 16 slides, with interactive quizzes, text slides and 1 video.

time-iconLesson duration is: 50 min

Items in this lesson


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

Slide 1 - Open question

This item has no instructions

Do Now answer
Age
(User input)

Slide 2 - Slide

This item has no instructions

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

This item has no instructions

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

This item has no instructions

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

This item has no instructions

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

Slide 6 - Quiz

This item has no instructions

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

This item has no instructions

Slide 8 - Video

This item has no instructions

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

This item has no instructions

Slide 10 - Slide

This item has no instructions

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

Slide 11 - Drag question

This item has no instructions

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

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

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

This item has no instructions

Why do we need if statements in programming?

Slide 15 - Open question

This item has no instructions

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

This item has no instructions