This block works for EV3, Spike, Ruby Robot and Zappy!
Let’s check out the If block, which is also known as the If... Do block or the If/Else block.
The If block allows you to create conditions in your program. For example, using this block you can introduce the statement, “If the ultrasonic sensor detects a value of 50, drive straight,” into your program. The do commands will only be executed IF the condition is true.
Additional Options
Click the If block's blue plus button to add else or else if conditions to the block.
Configuration
Parameter | Description | Compatible Blocks |
if |
Adds a condition after the If parameter. Blocks are repeated in a loop if the condition is true. |
|
else if |
Defines an alternate condition. If the alternate condition is true, the commands that follow it are executed. |
|
else |
Commands that follow the Else parameter are executed if none of the conditions are true. |
|
Hints and Tips
You can configure the If block to repeat commands indefinitely by adding a True block as the condition!
Comments
Please sign in to leave a comment.