UnicMinds

Control Blocks in Scratch Programming

Control Blocks in Scratch

Control blocks in Scratch look like as shown above in the image. It has different blocks which can be categorised into three sections 👍

  • Wait, repeat and Forever
  • If , if else, wait until and repeat until
  • Clone blocks
Control Blocks in Scratch Program
Control Block Palette in Scratch

Let’s understand wait, repeat and Forever blocks with examples 

Here in the code shown below, the sprite (cat) says hello after a gap of 3 seconds after the flag is clicked.

Control Blocks in Scratch

Output of the code :

Say Hello - Scratch Cat - Control Blocks

2. Repeat block in Scratch

The code blocks kept inside the repeat block are executed by the computer the number of times specified in the repeat block.

For Ex:-

When the flag is clicked, the sprite (cat) will turn by 15 degrees only 10 times as the turn 15 degrees is inside the repeat block which will run for 10 times.

Code:                                                         Output:

3.Forever block in Scratch

The code blocks kept inside the Forever block are executed by the computer forever unless the program is stopped.

For Ex:-

When the flag is clicked , the sprite (cat) will turn by 15 degrees forever

Code:.                                                           

Control Blocks - rotation

Output:

Scratch Program Output - Rotate the cat

Let’s understand the code blocks – if, if else, wait until and repeat until blocks with examples

  1. If a block comes with a condition. For example: in the code below, the condition is touching the edge of the screen. If the condition is true, the computer executes the code written inside the if block. Whenever the cat touches the edge of the screen, the cat will change the color as shown in the output.

Code:

Programming Control Blocks in Scratch

Output:

Introduction to Control Blocks in Scratch
  1. If else block , there is a section added to the code above which is else block. Whenever the condition attached to the if is false , the computer goes to the else block and executes the code written inside the else block. For Ex: – In the code below , the cat changes the color whenever it touches the edge of the screen. If the cat is not touching the edge of the screen, the cat will show the original colour.

Code:

Control Blocks for Kids using Scratch

Output:

Output Window - Scratch Programming
Control Blocks - Scratch Programming for Kids

3.Wait until block has a condition attached to it, the computer will not execute the code put inside the wait until block till the condition is wrong. The moment the condition is true, the computer will start executing the code written inside the wait until block. For Ex: In the code below, the cat will keep increasing its size till the time is less than 10. The moment the time touched the value 10, the cat will stop increasing its size.

Using Control Blocks in Scratch
Output of Control Blocks Program in Scratch

4.  Waits until a certain condition is met. Repeat wait() until basically just put the script on hold until whatever is after until is equal to true. repeat … until is a loop that will keep running until met with a condition.

Control Blocks in Scratch
Scratch Program Output

Clone Blocks

Whenever the cat touches the edge, it creates copies of itself as shown in the image below.

Clone Blocks in Scratch

Whenever the clone is created , delete the clone. Hence, you see only one cat in the output as the clones get deleted every time it’s created on touching the edge.

Clone Blocks in Scratch

Output:

Scratch Clone Block Output

Hope this is useful, thank you.

You may like to read: Boolean Block in Scratch, Block Palette in Scratch, & Microbit & MicroPython Programming for Kids.

BOOK A FREE TRIAL