What is the Difference between warp and repeat? I'm here to help!
So, I am sure you guys know what repeats are, but for starters to Snap!, Repeats are blocks that go on for how much is given. Here is a Script Example:
The Repeat in this script line is the Block wrapping around the . Meaning that we repeat this block 10 times.
There are also , in which, you repeat whatever is inside it forever, until you stop the project.
Now that we covered repeat blocks, let's cover the warp block.
Like the repeat blocks, you can put blocks inside a warp block, but warping is not repeating. Let's say you have a really important thing you need to do. Like this Script example:
This time, instead of repeating this block. The warp block will do this before any other script. You can even put repeats in it in case you need to to the 10 times before doing any other thing. Other scripts cannot run until the script inside the warp block finishes.
So, in summary, repeating blocks are the Blocks that will repeat the Blocks Inside, while Warp Blocks stop other scripts from running until the script inside is finished. I hope this helps!
The warp block doesn't run before any other script, it justbruns the current script without other update, although it does usually stop other script from running. If the warp block takes to long, then it will update the stage, and also run the other code. You also want to make sure to never use any blocks that force the script to take too long, suvh as wait until, wait seconds, and forever. These will lag your project.
When using warp with loops, it's a bit more tricky. If it's something like a repeat 10, or for each, then it's fine to stick the warp block around the loop. If you have a forever loop, always make sure to stick the warp block around all the code inside the forever loop. This will make sure the screen updates, and other scripts are able to run.