Outcomes in Blockly - Part Two (Ages 5-8)
Hello everyone! Welcome back to part two of the Outcomes in Blockly activity. By the end of the activity, you’ll be able to change the outcome of a code by adding and changing blocks!
Before we begin:
- Make sure that you have your KINI robot, and that it is connected to the internet.
- Open the app, and go to the Blockly tab by clicking the Blockly button in the bottom right corner. We will be using the two Repeat blocks to create our code.
- Understand the basics of Blockly - if you don’t, I’d suggest checking out the “Introduction to Blockly” activity before this one.
- This is the second part of the Changing Outcomes in Blockly activity, so I encourage you to watch the first part before this one.
How changing one block changes the outcome:
- To start, we’ll use the following code that makes KINI move forwards for 20cm, turn right, then move forwards for 1 second.
- As you can see by this drawing of KINI’s movements, the outcome of the code is that KINI ends up forwards and to the right of where it started.
- What if we want to change this code so that KINI moves forwards and to the left. To change the outcome of this code, we can break it up into smaller pieces:
- The first piece of the code is “Move Forwards for 20cm”
- If we want KINI to move forwards and to the left, does this have to change? No!
- The second piece of the code is “Rotate Right for 1 Second”
- If we want KINI to move forwards and to the left, does this have to change? Yes!
- If you look at the drawing, this block is the action that makes KINI go right, which we don’t want.
- What can we do to change the outcome? We can use the Rotate Left block to make KINI go to the left instead of the right.
- The last piece of the code is “Move Forwards for 1 Second”
- If we want KINI to move forwards and to the left, does this have to change? No!
All we did to change the code was change the Turn Right block to a Turn Left block. This may seem like a small change, but it changed the outcome of our code completely. If you make a new drawing of this code, you’ll see that KINI moves forward and to the left, just like we wanted. You can see that every detail in coding matters, because changing a single block impacts the entire code!
Now that you’ve learnt about outcomes, each time you code KINI, try to first think of the outcome, then use blocks to make that outcome happen. Good luck, and have fun coding!