You can also use a sensor to control a loop in Python. The for loop that you have already used repeats the statements inside it a specific number of times. A while loop, on the other hand, repeats the statements inside it as long as a Boolean expression is true. For example, this code will make a tri-color LED red for as long as the value of the distance sensor is less than the threshold. The keyword while is followed by a Boolean expression, bird.getDistance(1) < threshold. If this expression is true, the program runs the statement inside the loop and turns the tri-color LED red. Then it checks the Boolean expression again. If it is still true, the program turns the tri-color LED red again, so you will see it stay red. The loop continues repeating the statement inside it until it checks the Boolean expression and finds that it is false. Then the program skips the indented statement inside the loop and moves on to the next unindented line of code. In this case, the program turns the tri-color LED green.