Skip to main content

Lesson 3: Post-Project Summary

Why did the VR Robot continue driving when it reached the green disk?

When this project is run, the VR Robot continues to drive forward even when colliding with the first green disk.

Video file

This project only instructs the VR Robot to check the conditions of each if else statement once at the beginning of the project.project flow of if statements where conditions are only checked once

The if statement is different from the while loop

  • While loops do not require a decision to be made by the VR Robot. When the condition is True, the while loop with a not condition executes the next command outside the loop. When the condition is False, the while loop with a not condition continues to wait until the condition is True, and stops the rest of the project from running.
    checking condition in a while not loop
  • If statements require the VR Robot to make a decision. If the condition is True, then the commands inside the if statement are executed. If the condition is False, then the commands inside the if statement are not executed.
    checking condition in an if statement project flow image
  • The Front Eye sensor detects no color at the beginning of the project, thus the last if statement returns True. The VR Robot will continue to drive forward since the last if statement was reported as True and all other blocks were reported as False at the beginning of the project. 
  • Notice that there aren't any loops in this project that can pause the project flow to repeatedly check a condition. The if  statement checks the condition once, then moves on. 
  • Save the project before moving on to the next Lesson, to learn about adding repeatedly checking conditions with if statements.

Questions

Please select a link below to access the lesson quiz.

Google Doc / .docx / .pdf