Coding with Anna and Elsa (A Frozen Guide to Blockly) - page 6

22
Seeing Elsa work with the “Sisters Design” has given Anna an idea. She thinks it
could be used to make a beautiful snowflake!
Nested Loops
1
What happens if you put a loop inside of
another loop? This is called a
nested loop
,
and it can help you create some amazing
drawings. Let’s try it! First, remix your
“Sisters Loop” project and call it “Sisters
Nested Loop.”
2
Change the
set character
parameter to
“Anna.” Then add a
turn right
block to the
end of your code. Change the degree
parameter to “60.”
3
Drag a
repeat
loop into the workspace, and
change the parameter to “6.” Put the
repeat
loop directly under the
set character
block.
Then drag the remaining code blocks inside
the
repeat
loop.
4
When you click
Run
, Anna will draw the
“Sisters” pattern six times with a turn of
60 degrees between each one. That’s an
interesting snowflake you’ve helped
Anna make!
5
What do you need to change if you want to
repeat the “Sisters” pattern seven, eight, or
nine times?
1,2,3,4,5 7,8,9,10,11,12
Powered by FlippingBook