The "Stop ( )" Block
-
Prerequisite
What is a Script?
A script is simply a stack of blocks. There can be one or multiple scripts in a sprite’s code.
Description
The “stop ( )” block is in the Control group. Depending on the option selected from the drop-down menu, this block can change its shape:
“stop (all)” and “stop (this script)” are cap blocks while “stop (other scripts in sprite)” is a stack block.
How does this block work?
The “stop ( )” block is used to stop some or all scripts in a project. Let’s look at each option below:
Stop (all)
The “stop (all)” option is used to stop all the scripts in the project. It has the same function as the red stop button. For example, you can use “stop ” when a game is over.
Stop (this script)
The “stop (this script)” option is used to only stop the script in which the stop block is used.
For Example: In the screencast below, when the timer value reaches 10, only the timer script stops, and the other script still keeps running.
Stop (other scripts in sprite)
This option is used to stop all the other scripts in the current sprite, except the script in which the stop block is used.
In the example below, as soon as the timer value reaches 10, the other script in the sprite stops running.