Using scratch "repeat until" will not exit when space bar is pressed unless the space bar is held down continually. I am learning scratch. Working with LEDs (low voltage lab stoplight). I have them blinking in a sequence. I press the space bar and the sequence pauses. If I hold the space bar down for a couple seconds, the sequence will stop.

Scratch Code Stop Light


The repeat condition is checked only after every loop, so you have to press it until the current loop is finished.

Alternatively, you can signal an event on keypress: when space key pressed broadcast messageStop and use this message to stop the loop.

If you want to stop immediately without finishing the loop do when space key pressed stop all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.