Loops

Icons & HintsExamples
Hints: Use this to start a loop while the touch sensor is pressed. The loop will end when the touch sensor is release. If the touch sensor is not pressed when the program reaches this command, it skips the loop. To avoid this, add a Wait for Push icon before this icon. An End of Loop icon is needed somewhere after this icon. This piece of code would wait until the touch sensor was pushed, then start a loop that would continuously play the note C and a rest while the touch sensor remained pushed. When the touch sensor is released, it will play a sound.
Hints: Use this to start a loop while the touch sensor is NOT being pressed. The loop will end when the touch sensor is pressed. If the touch sensor is pressed when the program reaches this command, it skips the loop. An End of Loop icon is needed somewhere after this icon. This piece of code would start a loop that would continuously play the note C and a rest while the touch sensor remained released. When the touch sensor is pressed, it will play a sound.
Hints: Use this to start a loop while the number of touches and releases is less than a certain value. It may be helpful to zero the touch and release sensor before this command. An End of Loop icon is needed somewhere after this icon. This piece of code would start a loop that would continuously play the note C and a rest until the number of touches and releases was 10 (the default).
Hints: Use this to start a loop while the number of clicks is less than a certain value. It may be helpful to zero the clicks sensor before the command. An End of Loop icon is needed somewhere after this icon. This piece of code zeros the clicks sensor and then starts a loop that would continuously play the note C and a rest until the number of clicks was 10 (the default).
Hints: Use this to start a loop while the light sensor value is below a certain number. The loop will end when the light sensor value goes above that number. If the light sensor value is above that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop that would continuously play the note C and a rest until the light sensor value became 55 (the default) or higher.
Hints: Use this to start a loop while the light sensor value is above a certain number. The loop will end when the light sensor value goes below that number. If the light sensor value is below that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop that would continuously play the note C and a rest until the light sensor value became 55 (the default) or higher.
Hints: Use this to start a loop while the container value is less than a certain number. The loop will end when the container value gets to that number or above. If the container value is above that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code would zero the container. Then it would start a loop that plays the note C and adds one to the container. The loop would end when the container reaches 5. In total, it will play the note C five times.
Hints: Use this to start a loop while the container value is greater than a certain number. The loop will end when the container value gets to that number or below. If the container value is below that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code sets the container value to 5. Then it starts a loop that plays the note C and subtracts one from the container. The loop would end when the container value equals 1 (the default). In total, it will play the note C four times.
Hints: Use this to start a loop while the rotation sensor reads below a certain value. The loop will end when the angle sensor gets to or goes beyond that value. It is helpful to use a zero angle sensor icon before this command. An End of Loop icon is needed somewhere after this icon. This piece of code zeros the angle sensor then starts a loop that continuously plays the note C and a rest until the rotation sensor reads a value of 16 (one rotation, the default).
Hints: Use this to start a loop while the rotation sensor reads above a certain value. The loop will end when the angle sensor gets to or goes below that value. It may be helpful to use a zero angle sensor icon before this command. An End of Loop icon is needed somewhere after this icon. This piece of code waits until the rotation sensor reads a value greater than 16 (one rotation, the default) then starts a loop that will continuously play the note C and a rest until the rotation sensor reads a value of 16 or less.
Hints: Use this to start a loop while the timer value is less than a certain number. The loop will end when the timer gets to that number. It is helpful to use a zero timer value before this command. An End of Loop icon is needed somewhere after this icon. This piece of code zeros the timer then starts a loop that plays the note C and a rest until the time reaches 5 seconds (the default).
Hints: Use this to start a loop while the timer value is greater than a certain number. The loop will end when the timer gets to or goes below that number. If the timer is below that number. When the program gets to this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code waits for the timer to reach 5 seconds. Then it starts a loop that plays the note C and a rest continuously until the timer goes below 5 seconds (the default). If nothing external changes the value of the timer, the loop will repeat forever.
Hints: Use this to start a loop while the timer value (read in hundredths of seconds) is less than a certain number. The loop will end when the timer gets to that number. It is helpful to use a zero timer value before this command. An End of Loop icon is needed somewhere after this icon. This piece of code zeros the timer then starts a loop that plays the a beep and a rest until the time reaches 600 hundredths of seconds ().
Hints: Use this to start a loop while the timer (read in hundredths of seconds) value is greater than a certain number. The loop will end when the timer gets to or goes below that number. If the timer is below that number. When the program gets to this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code zeros the timer and then waits for 6 seconds. While the timer is greater than 600 hundredths of seconds, it plays a beep, waits for 2 seconds and then zeros the timer. The second resenting of the timer makes the loop condition untrue so the program finishes.
Hints: Use this to start a loop while the temperature is below a certain value. The loop will end when the temperature rises to or above that value. If the temperature is above that value when the program gets to this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code turns on motor A in the forward direction then starts a loop which continuously flips the direction of the motor and waits 1 second until the temperature gets to or goes above 30 degrees Celsius. When this happens, motor A is shut off.
Hints: Use this to start a loop while the temperature is above a certain value. The loop will end when the temperature drops to or below that value. If the temperature is below that value when the program gets to this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code turns on motor A in the forward direction then starts a loop which continuously flips the direction of the motor and waits 1 second until the temperature gets to or goes below 30 degrees Celsius. When this happens, motor A is shut off.
Hints: Use this to start a loop while the value of the mail is below a certain number. The loop will end when the value of the mail becomes that number or higher. If the value of the mail is higher than that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code empties the mailbox then starts a loop which turns on lamp A. The loop ends when the RCX receives mail whose value is 1 or greater. Then the RCX plays a sound and turns off the lamp.
Hints: Use this to start a loop while the value of the mail is above a certain number. The loop will end when the value of the mail becomes that number or lower. If the value of the mail is less than that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code fills the mailbox with the value of 5 then starts a loop which turns on lamp A. The loop ends when the RCX receives mail whose value is 4 or less. Then the RCX plays a sound and turns off the lamp.
Hints: Use this to start a loop while the temperature is below a certain value. The loop will end when the temperature rises to or above that value. If the temperature is above that value when the program gets to this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code turns on motor A in the forward direction then starts a loop which continuously flips the direction of the motor and waits one second until the temperature gets to or goes above 80 degrees Fahrenheit. When this happens, motor A is shut off.
Hints: Use this to start a loop while the temperature is above a certain value. The loop will end when the temperature drops to or below that value. If the temperature is below that value when the program gets to this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code turns on motor A in the forward direction then starts a loop which continuously flips the direction of the motor and waits one second until the temperature gets to or goes below 80 degrees Fahrenheit. When this happens, motor A is shut off.
Hints: Use this to start a loop while the RCX clock value is less than a certain number. The loop will end when the clock goes above that number. An End of Loop icon is needed somewhere after this icon. This piece of code plays notes C and D continuously until the RCX clock goes above 1 minute (the default). Then it turns the RCX power off.
Hints: Use this to start a loop while the RCX clock value is greater than a certain number. The loop will end when the clock goes below that number. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop while the RCX clock value is greater then 1 minute (the default). It continuously plays the notes C and D. If the clock goes below 1 minute, the loop stops. If nothing external resets the value of the clock, the loop will repeat forever.
Hints: Use this to start a loop while the NXT touch sensor is pressed. The loop will end when the touch sensor is release. If the touch sensor is not pressed when the program reaches this command, it skips the loop. To avoid this, add a Wait for Push icon before this icon. An End of Loop icon is needed somewhere after this icon. This piece of code would wait until the touch sensor was pushed, then start a loop that would continuously play the note C and a rest while the touch sensor remained pushed. When the touch sensor is released, it will play a sound.
Hints: Use this to start a loop while the NXT touch sensor is NOT being pressed. The loop will end when the touch sensor is pressed. If the touch sensor is pressed when the program reaches this command, it skips the loop. An End of Loop icon is needed somewhere after this icon. This piece of code would start a loop that would continuously play the note C and a rest while the touch sensor remained released. When the touch sensor is pressed, it will play a sound.
Hints: Use this to start a loop while the NXT light sensor value is below a certain number. The loop will end when the light sensor value goes above that number. If the light sensor value is above that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop that would continuously play the note C and a rest until the light sensor value became 50 or higher. It would then turn on Motor A for 2 seconds, stop Motor A for 1 second, and then jump back to the beginning of the code to start again.
Hints: Use this to start a loop while the NXT light sensor value is below a certain number. The loop will end when the light sensor value goes above that number. If the light sensor value is above that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop that would continuously play the note C and a rest until the light sensor value became 50 or less. It would then turn on Motor A for 2 seconds, stop Motor A for 1 second, and then jump back to the beginning of the code to start again.
Hints: Use this to start a loop while the NXT distance sensor value is below a certain number. The loop will end when the distance sensor value goes above that number. If the distance sensor value is above that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop that would continuously play the note C and a rest until the distance sensor value became 50 or less. It would then turn on Motor A for 2 seconds, stop Motor A for 1 second, and then jump back to the beginning of the code to start again.
Hints: Use this to start a loop while the NXT distance sensor value is below a certain number. The loop will end when the distance sensor value goes above that number. If the distance sensor value is above that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop that would continuously play the note C and a rest until the distance sensor value became 50 or greater. It would then turn on Motor A for 2 seconds, stop Motor A for 1 second, and then jump back to the beginning of the code to start again.
Hints: Use this to start a loop while the NXT sound sensor value is below a certain number. The loop will end when the sound sensor value goes above that number. If the sound sensor value is above that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop that would continuously run Motor A in reverse until the sound sensor value became 50 or less. It would then turn on Motor A forward for 2 seconds, stop Motor A for 1 second, and then jump back to the beginning of the code to start again.
Hints: Use this to start a loop while the NXT sound sensor value is below a certain number. The loop will end when the sound sensor value goes above that number. If the sound sensor value is above that number when the program reaches this command, it will skip the loop. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop that would continuously run Motor A in reverse until the sound sensor value became 50 or greater. It would then turn on Motor A forward for 2 seconds, stop Motor A for 1 second, and then jump back to the beginning of the code to start again.
Hints: Use this to start a loop while the NXT rotation sensor reads below a certain value. The loop will end when the angle sensor gets to or goes beyond that value. It is helpful to use a zero angle sensor icon before this command. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop that would continuously run Motor A while the rotation sensor value was 720 or less. When the rotation value is greater than 720, Motor A stops for 2 seconds, then Motor A runs in reverse for 2 seconds. Next, Motor A stops for 4 seconds before jumping back to the beginning to start again.
Hints: Use this to start a loop while the NXT rotation sensor reads above a certain value. The loop will end when the angle sensor gets to or goes below that value. It may be helpful to use a zero angle sensor icon before this command. An End of Loop icon is needed somewhere after this icon. This piece of code turns on Motor A for 2 seconds. Then, it starts a loop that would continuously run Motor A in reverse while the rotation sensor has a value of greater than 720. When it becomes less than 720, Motor A stops for 2 seconds and jumps back to the beginning of the code to start again.
Hints: Use this to start a loop while the value of a container is less than some number. The loop will end when the container goes above that number. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop while the camera container value is less than 1 (the default). It turns on motor A. When the container value is greater than 1, the loop stops and turns off motor A.
Hints: Use this to start a loop while the value of a container is greater than some number. The loop will end when the container goes below that number. An End of Loop icon is needed somewhere after this icon. This piece of code starts a loop while the camera container value is greater than 1 (the default). It turns on motor A. When the container value is less than 1, the loop stops and turns off motor A.
Hints: Use in Investigator. Use this to start a loop while the number of data points is less than some number. The loop will end when the number of data points gets to or goes above that number. An End of Loop icon is needed somewhere after this. This piece of code begins logging light sensor points and enters a loop. Inside the loop it adds a time stamp to the data set and waits for 10 more points. This continues until there are 150 points or more, then the data logging stops.
Hints: Use this piece of code to start a loop that is going to be repeated a certain number of times. An End of Loop icon is needed somewhere after this icon. This piece of code would turn lamp A on for 2 seconds and then off for 2 seconds and repeat this 9 more times. In total, the light blinks 10 times.
Hints: ALWAYS end loops with this icon. This piece of code would turn lamp A on for 2 seconds and then off for 2 seconds and repeat this 9 more times. In total, the light blinks 10 times.
Hints: Use this piece of code to start a forever loop that is going to be repeated a certain number of times. An End of Forever Loop icon is needed somewhere after this icon. This piece of code would turn lamp A on for 2 seconds and then off for 2 seconds and repeat this 9 more times. In total, the light blinks 10 times.
Hints: ALWAYS end loops with this icon. This piece of code would turn lamp A on for 2 seconds and then off for 2 seconds and repeat this 9 more times. In total, the light blinks 10 times.
Hints: Use this to start a loop while the value of the generic sensor adapter is less than some number. The loop will stop when the value goes above that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the generic sensor adapter is less than 2V (the default). When the reading goes above this, the loop will stop.
Hints: Use this to start a loop while the value of the generic sensor adapter is greater than some number. The loop will stop when the value goes below that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the generic sensor adapter is greater than 2V (the default). When the reading goes below this, the loop will stop.
Hints: Use this to start a loop while the value of the humidity sensor adapter is less than some number. The loop will stop when the value goes above that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the humidity sensor adapter is less than 50% (the default). When the reading goes above this, the loop will stop.
Hints: Use this to start a loop while the value of the humidity sensor adapter is greater than some number. The loop will stop when the value goes below that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the humidity sensor adapter is greater than 50% (the default). When the reading goes below this, the loop will stop.
Hints: Use this to start a loop while the value of the pH sensor adapter is less than some number. The loop will stop when the value goes above that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the pH sensor adapter is less than 7 (the default). When the reading goes above this, the loop will stop.
Hints: Use this to start a loop while the value of the pH sensor adapter is greater than some number. The loop will stop when the value goes below that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the pH sensor adapter is greater than 7 (the default). When the reading goes below this, the loop will stop.
Hints: Use this to start a loop while the value of the pressure sensor adapter is less than some number. The loop will stop when the value goes above that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the pressure sensor adapter is less than 100 kPa (the default). When the reading goes above this, the loop will stop.
Hints: Use this to start a loop while the value of the pressure sensor adapter is greater than some number. The loop will stop when the value goes below that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the pressure sensor adapter is greater than 100 kPa (the default). When the reading goes below this, the loop will stop.
Hints: Use this to start a loop while the value of the sound level sensor adapter is less than some number. The loop will stop when the value goes above that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the sound level sensor adapter is less than 60 dB (the default). When the reading goes above this, the loop will stop.
Hints: Use this to start a loop while the value of the sound level sensor adapter is greater than some number. The loop will stop when the value goes below that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the sound level sensor adapter is greater than 60 dB (the default). When the reading goes below this, the loop will stop.
Hints:Use this to start a loop while the value of the temperature sensor adapter is less than some number. The loop will stop when the value goes above that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the temperature sensor adapter is less than 30 degrees Celsius (the default). When the reading goes above this, the loop will stop.
Hints: Use this to start a loop while the value of the temperature sensor adapter is greater than some number. The loop will stop when the value goes below that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the temperature sensor adapter is greater than 30 degrees Celsius (the default). When the reading goes below this, the loop will stop.
Hints: Use this to start a loop while the value of the position sensor adapter is less than some number. The loop will stop when the value goes above that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the position sensor adapter is less than 180 degrees (the default). When the reading goes above this, the loop will stop.
Hints: Use this to start a loop while the value of the position sensor adapter is greater than some number. The loop will stop when the value goes below that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the position sensor adapter is greater than 180 degrees (the default). When the reading goes below this, the loop will stop.
Hints: Use this to start a loop while the value of the voltmeter is less than some number. The loop will stop when the value goes above that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the voltmeter is less than 2V (the default). When the reading goes above this, the loop will stop.
Hints: Use this to start a loop while the value of the voltmeter is less than some number. The loop will stop when the value goes above that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the voltmeter is less than 2V (the default). When the reading goes above this, the loop will stop.
Hints: Use this to start a loop while the value of the accelerometer is greater than some number. The loop will stop when the value goes below that number. An End of Loop icon is needed somewhere after this icon. This piece of code will start a loop that plays notes C and D continuously while the value of the voltmeter is greater than 25 m/s/s (the default). When the reading goes below this, the loop will stop.
Hints: Use this to start a loop while the value of the container is equal to the specified number. This piece of code empties the red container. The loop iterates while the red container is equal to zero. If the touch sensor is pressed the red container is set to 1 and the loop will stop running.
Hints: Use this to start a loop while the value of the container is equal to the specified number. This piece of code fills the red container with the number 10. The loop runs (plays a sound) while the red container is not equal to zero. If the touch sensor is pressed the red container is set to zero and the loop stops running.