This lesson contains 13 slides, with interactive quizzes and text slides.
Items in this lesson
Conditionals: If, Then, and Beyond!
Slide 1 - Slide
This item has no instructions
Learning Objective
At the end of the lesson you will be able to define what a conditional statement is and use it to create conditional expressions in your code.
Slide 2 - Slide
Explain to the students what they will be able to do after completing the lesson.
What do you already know about conditionals?
Slide 3 - Mind map
This item has no instructions
What are Conditionals?
Conditionals are statements that execute different pieces of code depending on whether a condition is true or false.
Slide 4 - Slide
Introduce the concept of conditionals to the students.
If Statements
The most basic conditional statement is the 'if' statement. It executes a block of code only if a specified condition is true.
Slide 5 - Slide
Explain the syntax of 'if' statements and provide simple examples.
Else Statements
An 'else' statement can be added to an 'if' statement to execute a block of code if the condition is false.
Slide 6 - Slide
Explain the syntax of 'else' statements and provide examples including if-else statements.
Else If Statements
An 'else if' statement can be added between the 'if' and 'else' statements to execute a block of code if the first condition is false and a second condition is true.
Slide 7 - Slide
Explain the syntax of 'else if' statements and provide examples including nested if-else statements.
Logical Operators
Logical operators like 'and', 'or', and 'not' can be used to combine multiple conditions in a single conditional statement.
Slide 8 - Slide
Explain the syntax of logical operators and provide examples of how they can be used in conditional statements.
Ternary Operators
Ternary operators provide a shorthand way of writing simple if-else statements in a single line of code.
Slide 9 - Slide
Explain the syntax of ternary operators and provide examples.
Switch Statements
Switch statements can be used to execute different blocks of code depending on the value of a single variable or expression.
Slide 10 - Slide
Explain the syntax of switch statements and provide examples.
Write down 3 things you learned in this lesson.
Slide 11 - Open question
Have students enter three things they learned in this lesson. With this they can indicate their own learning efficiency of this lesson.
Write down 2 things you want to know more about.
Slide 12 - Open question
Here, students enter two things they would like to know more about. This not only increases involvement, but also gives them more ownership.
Ask 1 question about something you haven't quite understood yet.
Slide 13 - Open question
The students indicate here (in question form) with which part of the material they still have difficulty. For the teacher, this not only provides insight into the extent to which the students understand/master the material, but also a good starting point for the next lesson.