What is the If () Then Else Block?
The If () Then block is great, but what if you want your program to do something different when the condition is false? That's where the If () Then Else block comes in. It handles both cases — when the condition is true and when it is false.
The If () Then Else block checks a condition. If the condition is true, the first set of blocks runs. If the condition is false, the second set of blocks (the 'else' part) runs instead.

If () Then vs If () Then Else
Comparing the Two Blocks
Example: Pass or Fail
Let's build a script that asks the user for a score, then tells them whether they passed or failed. A score of 50 or above is a pass.
- Ask the user 'What is your score?' and save the answer to a variable called Score.
- Add an If () Then Else block.
- Set the condition to (Score ≥ 50).
- In the 'then' section, add Say (Congratulations! You passed!) for 3 seconds.
- In the 'else' section, add Say (Sorry, you failed. Try again!) for 3 seconds.
- Click the green flag and enter a score to test both outcomes.

If () Then Else blocks can also be nested inside each other to handle multiple conditions. This is how programs make complex decisions!

.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)