Lesson 5: Conditionals in Scratch
What You'll Learn
In this lesson, we'll explore conditionals in Scratch. You'll learn how to use if statements and if-else statements to make decisions in your code, allowing your sprites to respond to different conditions.
Key Concepts
Conditional
A statement that performs different actions based on whether a condition is true or false.
Boolean
A data type that represents one of two values: true or false.
If Statement
A conditional that executes a set of instructions only if a certain condition is true.
If-Else Statement
A conditional that executes one block of code if a condition is true and another if it's false.
Blocks We'll Use
Control Blocks
- If [ ] then
- If [ ] then ... else
Sensing Blocks
- Key [ ] pressed?
- Touching [ ]?
- Mouse down?