How to use the if/else block in LEGO SPIKE Prime Word Blocks software Pro Preview

Have you ever wondered if your robot can make decisions? Here's how we can make that happen!

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #2292
  • 29 Jul 2024

The if/else block is the fifth block in the orange Control section.

content picture

It is used in combination with a Logic block, that you can put inside the if/else block. The Logic block determines if the blocks in the if/then section of the block will be run or the blocks in the else section will be run!

Logic blocks can primarily be found in the Sensors and Operators sections.

content picture

Logic blocks can either be True or False. If the block is True, the first set of blocks will run; if it's False, the second set of blocks will run. For example, if we use the force sensor logic block as shown in the picture above, it will be False if the sensor isn't pressed and True if the sensor is pressed. So, if the force sensor is pressed, then the blocks inside the if/then section will run; else, the blocks in the else section will run!

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for  Level B1 - Carnival - Robotics with LEGO SPIKE Prime
  • 23
  • 1:03
  • 62
Image for Lesson 5 - Ferris Wheel
  • 4
  • 5
  • 9
  • 3d_rotation 1
Image for Level B2 - Introduction to Robotics Competitions   - Robotics with LEGO SPIKE Prime
  • 21
  • 1:03
  • 60
Image for Lesson 6 - Line Following Part 2
  • 4
  • 6
  • 7
  • 3d_rotation 2