Conditionals: If, Then, and Beyond!

Conditionals: If, Then, and Beyond!
1 / 13
suivant
Slide 1: Diapositive

Cette leçon contient 13 diapositives, avec quiz interactifs et diapositives de texte.

Éléments de cette leçon

Conditionals: If, Then, and Beyond!

Slide 1 - Diapositive

Cet élément n'a pas d'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 - Diapositive

Explain to the students what they will be able to do after completing the lesson.
What do you already know about conditionals?

Slide 3 - Carte mentale

Cet élément n'a pas d'instructions

What are Conditionals?
Conditionals are statements that execute different pieces of code depending on whether a condition is true or false.

Slide 4 - Diapositive

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

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

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

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

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

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

Explain the syntax of switch statements and provide examples.
Write down 3 things you learned in this lesson.

Slide 11 - Question ouverte

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 - Question ouverte

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 - Question ouverte

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.