The structure on the right side of the scratch coding works, as the number of steps taken multiplied by the number of loops equals 100 steps.
The loop that repeats forever works the best as the condition repeats itself and remains active forever, so it will respond forever, rather than only respond to the condition for a set number of cycles.
#1-Loops: Scratch contains three different types of loops, ones that repeat themselves forever, ones that repeat forever until a condition is met, and ones that repeat for a set number of times and then stop.
#2-No end in sight: If you are unsure how long an action should be repeated, it is best to use a conditional loop as it ends as soon as a condition is met, so if you wanted a sprite to walk to the edge of the screen, you could set it to end the loop once he touched the edge.
#3-Forever Loops: The loop displayed will not work and does not makes sense as the internal loop must be completed before the outside loop can begin, but because the loop repeats forever, the outside loop never starts.
#4-Sprite communication: Sprites know to start an action when they eithe recieve a message or meet a set condition.
#5-Conditionals: The code snippets are equivalent as they produce the same end result of changing the costume and waiting if the spacebar is not pressed, or saying the spacebar has been pressed if the spacebar is pressed.
Home