The Stop Program block immediately terminates all programming block sequences and ends the program.
You can put a Stop Program block at the end of any sequence in your program, including sequences that appear inside a Switch, Loop, or My Block. If the Stop Program block is reached and executes, the entire program will end.
Tips and Tricks
The Stop Program block is optional. When all sequences in a program end, the program ends automatically.
Example - Stopping a Program from a Second Sequence
This program has two sequences that will start automatically at the beginning of the program and run at the same time. The first sequence tells the robot to drive forward for 10 rotations, and then it ends the program with a Stop Program block. The second sequence waits for the Touch Sensor to be pressed, and then it ends the program with another Stop Program block.
The result of the program above is that the robot (and the program) will stop when either the robot has driven for 10 rotations or the touch sensor is pressed, whichever comes first.