Activity 3 – Order of Execution

Step 1

Have a look at the following blocks. What do you think will happen when they are executed? Do you think they will output the same values or different values? Have a guess and then try out the code for yourself!

Example 1

activity3 example1

Example 2

activity3 example2

Step 2

Different computer languages handle calculations in different ways. In Scratch, it’s pretty straight forward:

Scratch always calculates the answer to the maths in the inner block first, and then works it’s way back out!

This is similar to how you use brackets in maths lessons.

So here is what the examples above would look like in a maths lesson!

Example 1

Answer = 5 + ( 5/ 5)

calc2 (1)

Example 2

Answer = (5 + 5) / 5


Step 3

See if you can work out the answer to these maths questions.

Write down your answers and then them in Scratch.

Remember to work out the answers from the inside blocks first, then move outwards.

Question 1


Question 2