Skip to main content

Lesson 3: Using Conditionals

In the previous Lesson, you reached the end of the Disk Maze using the Eye Sensor and [Wait until] blocks. This Lesson introduces the [If then] block and how to use this block in the Disk Maze Challenge.

start to end

Learning Outcomes

  • Identify that the [If then] block is a C block that runs the blocks inside of it if the Boolean condition is reported to be TRUE.
  • Identify that you can have multiple [If then] blocks in a project to be able check for multiple colors, and have multiple behaviors based on those colors.

Observing Patterns and Using Conditional Statements

In Lesson 2, a pattern was identified for the way the VR Robot must drive when a specific color is reported by the Eye Sensor on the Disk Maze Playground.

  • Front Eye Sensor detects ‘green?’
    • Turn right 90 degrees
      turn right 90 degrees
  • Front Eye Sensor detects ‘blue?’
    • Turn left 90 degrees
      turn left highlights

This logic can be used to simplify the VEXcode VR Project with the [If then] block. [If then] blocks are conditional statements that instruct the VR Robot to make a decision if a specified condition is TRUE.

if then block

Select the Next button to continue with the rest of this Lesson.