Part 3 - If Statements
Summary
If statements are a type of conditional logic. They check whether a condition is true and run one block of code if it is, and another block if it is not.
Syntax
Example
This checks for keyboard input. If the player presses A, D, Left Arrow, or Right Arrow, the player moves. Otherwise, the script returns without moving the player.
Checklist
- I can explain what an if statement does.
- I can read basic if/else logic in a script.