How to make our robot wait until something happens Pro Preview

The "wait()" command is useful if we wish the robot to wait for a specific amount of time, but if we wish for our robot to wait until a given condition is met, we need to be a bit more inventive.

To access the full video please subscribe to


  • #1631
  • 11 Jun 2020

The "pass" serves as an empty that can be placed in the "while" operator. This way the loop operator will repeat without executing any code until the condition becomes false.

Here's what this should look like in your code:

while condition:
(code that doesn't execute until the condition is false)

Written like this, the code will await the condition of the "while" operator to become false in order to continue. In order for it to wait for the condition to be met, the "not" operator should be applied:

while not condition:
(code that will execute when the condition is met)

This way the robot will wait for the condition of the "while" operator to become true before continuing with the program.

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Python with LEGO Mindstorms EV3 - Level 2
  • 39
  • 19:58
  • 93
Image for Lesson 2 - Grabber control panel
  • 6
  • 6
  • 7
  • 3d_rotation 2