Repeating Patterns with Loops

Find out how a loop makes a computer repeat steps for you. You will spot repeating patterns, use repeat blocks to draw shapes and make beats and number patterns, put loops inside loops to build bigger designs, keep animations going with forever loops, and predict, test and fix programs that use loops.

Grade 2, Grade 3Lesson 2 of 10 in Computing and Coding for Ages 7 to 11 Course

What you will learn

  1. Find the steps that happen again and again, use a repeat block to run them as many times as you need, and see how a loop makes a program shorter and easier to change.
    • Find the part that repeats
      Look at a list of steps in a song, a dance, a path or a program, find the group of steps that repeats, and count how many times it comes.
    • Make a repeat block run your steps
      Put blocks inside a repeat block, set how many times it runs, and say what happens before, during and after the loop.
    • Make programs shorter and easier to change
      Rewrite a long program with a loop, count how many blocks you save, and see why shorter code is easier to read, change and fix.
  2. Use repeat blocks to draw shapes with equal sides, and make repeating patterns with lines, sounds and number jumps.
    • Draw shapes with equal sides
      Program a sprite or turtle with a pen to draw squares, triangles and other shapes with equal sides by repeating a move and a turn.
    • Make patterns with lines, sounds and number jumps
      Use a loop to make dashed lines, staircases, drum beats and number patterns, such as counting by threes on a number line.
  3. Understand nested loops, count how many times each part runs, and use them to build bigger designs out of repeated shapes.
    • Understand how a loop inside a loop runs
      Read and run a loop inside another loop, and work out how many times each block inside it runs.
    • Build designs from repeated shapes
      Use an inner loop to draw a shape and an outer loop to repeat that shape in a row or around a point.
  4. Use a forever loop for actions that should keep going until you stop the program, choose between forever and repeat, and make sprites move and change in simple animations.
    • Choose a forever loop or a repeat loop
      Know what a forever loop does, how it stops, and when to use it instead of a repeat block with a number.
    • Animate a sprite with loops
      Make sprites seem to move by repeating costume changes, small moves and short waits, with a repeat block or a forever loop.
  5. Read a program with loops and say what it will do before you run it, then test it and find and fix loop bugs one step at a time.
    • Predict what a loop will do
      Read a program with loops, work out what it will draw, play or say and how many times each block runs, and then run it to check.
    • Find and fix bugs in loops
      Test a program with loops, find the mistake when it does not do what you wanted, and fix it by changing one thing at a time.

Loops in Coding study guide

5 chapters

1

Spot repeats and use repeat blocks

You already know how to put blocks in order. Now look for steps that come back again and again. You will find a repeating group, wrap it in a repeat block and follow every round. Then you will compare a long stack with a shorter loop and check that both do the same job.

1.1 Spot the repeating group

A dance can have lots of steps but only one short pattern. When you spot that pattern, you can give much shorter instructions.

Look for matching groups

An instruction tells you one step to do. A sequence puts steps in order. A repeating pattern has a group that comes again in the same order. Repetition means doing something again. Another name for it is iteration. In a program, a loop repeats instructions.

Try saying this dance aloud:

"Clap, clap, stomp, clap, clap, stomp, clap, clap, stomp, clap, clap, stomp."

Start with the smallest group that fits: "clap, clap, stomp." Mark each copy with a line:

"Clap, clap, stomp | clap, clap, stomp | clap, clap, stomp | clap, clap, stomp."

There are four matching groups. Each group has three actions. Adding the group sizes gives 12 actions:

3+3+3+3=12

The short instruction is "repeat four times: clap, clap, stomp." The repeat number counts groups. It does not count all 12 actions.

Keep the extra steps

Now try "stand up, hop, hop, hop, hop, hop, sit down." Only "hop" repeats. Say "stand up, repeat five times: hop, then sit down." You stand up and sit down once each.

A song's chorus can repeat while its beginning and ending happen once. A robot path can repeat "forward, turn right" four times. With equal forward moves and quarter turns, that path makes a square.

Check the last group too

Look at "jump, clap, jump, clap, jump, stomp." The first two groups match: "jump, clap." The ending is different. You can repeat "jump, clap" twice, then add "jump, stomp."

To find a repeat yourself:

  1. Write or say all the steps in order.
  2. Mark the smallest group that repeats exactly.
  3. Count the copies of that whole group.
  4. Leave any extra beginning or ending outside.

Key Takeaways

  • A loop repeats instructions in a program.
  • Count copies of the whole group, not individual actions.
  • Check that the order matches in every copy.
  • Keep one-time beginning and ending steps outside the repeat.

1.2 Read the inside of a repeat block

A repeat block wraps around the instructions you want to do again. Its shape helps you see which blocks belong together.

Follow one round

A repeat block often looks like the letter C. Blocks fit inside its gap. Its number tells the computer how many times to run those inside blocks. A loop with a set number is a count-controlled loop.

Read this program from the top:

say "Ready!" for 1 second
repeat 3
    play drum sound
    wait 1 second
say "Done!" for 1 second

The spaces show which blocks sit inside the loop. First, the sprite says "Ready!" once. Then it plays a drum and waits. That is one whole round. It goes back to the first inside block for round two. It plays and waits again for round three. After that, it says "Done!" once.

Inside, before and after
Where the block sitsWhen it runs
Above the loopOnce, before the repeats
Inside the loopOn every round
Below the loopOnce, after the last round

Drag the "Done!" block inside, below the wait, and the sprite says it three times. Its words stay the same, but its place changes what happens.

Count what happens

A loop with five rounds and a 10-step move travels 50 steps along its path:

10+10+10+10+10=50

You can also think "five groups of ten." Three rounds with two drum blocks inside make six drum sounds. The number on the repeat block counts rounds, not how many blocks fit inside.

Order matters too. repeat 2 with clap then jump gives "clap, jump, clap, jump." Swapping the inside blocks gives "jump, clap, jump, clap." The totals match, but the dance changes.

Put the whole group inside

To draw a square, the sprite must move and turn each round. If only the move is inside repeat 4, it moves four times along one straight path. A turn below that loop happens just once, at the end. Put the move and the turn inside together.

Key Takeaways

  • The repeat number tells you how many rounds to run.
  • Inside blocks run from top to bottom on every round.
  • A block below a fixed repeat starts after the loop finishes.
  • Count every copy of each inside action.
  • Changing a block's place or order can change the result.

1.3 Replace copies with one loop

Copying blocks works, but a long stack can be hard to check. A loop lets you keep one copy of the repeating group.

Count blocks you can see

Drawing a square takes four copies of move 100 steps and turn right 90 degrees. That makes eight blocks in the long stack:

4×2=8

The loop version has one repeat block and two inside blocks:

repeat 4
    move 100 steps
    turn right 90 degrees

Count each visible block once. There are three blocks, even though the move and turn each run four times. The saving is five blocks:

8−3=5

For ten copies of "move 10 steps, play pop sound," the long stack needs 20 blocks. One repeat block and those two inside blocks need three. That saves 17 blocks. More copies mean more places where a loop can save work.

Change one place

Want a bigger square? In the long stack, change all four move blocks. In the loop, change the single move from 100 to 150 steps. Every side becomes longer. Want eight hops instead of four? Change the repeat number.

A shorter, clearer program is more efficient for the person building and reading it. Fewer copied blocks make mistakes easier to spot. One copied turn might say 80 degrees when the others say 90. A loop repeats the same turn each time. If that turn is wrong, you can fix it in one place.

Check that it still matches

Unroll a loop by writing every action in order. For repeat 3 around "forward, turn right," write:

"Forward, turn right, forward, turn right, forward, turn right."

Compare this with the long stack. Check the actions, their order and how many times they happen. A short program with only three sides still fails to draw a square.

A one-time action needs no repeat block. Wrapping it in repeat 1 adds a block without saving copies. A comment, such as "draws one square," can help a person understand a loop. The computer ignores that note.

Key Takeaways

  • Count visible blocks separately from how many times they run.
  • A loop lets you change all repeats in one place.
  • Unroll a loop to check its actions, order and count.
2

Draw shapes and patterns with loops

A sprite can draw as it moves, just like a pencil following directions. You will choose moves and turns to close a shape. Then you will build dashed lines, stairs, beats and number jumps. The same idea guides them all: plan one group, then repeat it.

2.1 Move and turn to close a shape

You can make a sprite or turtle draw by giving it a pen. A repeated move and turn can draw a whole shape.

Get ready to draw

Clear old lines. Choose a start spot and a facing direction. Lower the pen with pen down. It draws as the sprite moves. Use pen up to move without leaving a line.

move 100 steps goes forward in the direction the sprite faces. turn right 90 degrees changes that direction on the spot. It draws no side by itself. A quarter turn is 90 degrees. A full turn, all the way around, is 360 degrees.

Build a square
pen down
repeat 4
    move 100 steps
    turn right 90 degrees

Follow the rounds with your finger. Round one draws a side and turns. Round two draws the next side and turns. Round three draws another side. Round four draws the last side and turns back to the starting direction. The sprite returns to its starting spot.

The four turns make one full turn:

4×90=360
Choose the turn for each shape

A regular shape has equal sides and equal corners. For one trip around its edge, repeat once per side. Share one full turn equally between those sides:

turn=360÷number of sides
Regular shapeRepeatsTurn each round
Triangle3120 degrees
Square490 degrees
Pentagon572 degrees
Hexagon660 degrees
Octagon845 degrees

For a triangle, use repeat 3 with move 100 steps and turn right 120 degrees. Its three turns total 360 degrees.

The turn measures how far the sprite changes direction. The 60-degree corner inside an equal-sided triangle is different. Turning only 60 degrees three times draws half a hexagon, leaving an open path.

Change size or shape

A longer move makes each side longer. Keep the repeat number and turn the same to keep the shape. Change one number at a time and watch the result.

Changing a square to three repeats leaves one side missing. Changing it to eight repeats draws the same square twice. A tiny move repeated 36 times with a 10-degree turn makes 36 short sides. Together they look nearly round.

Left turns trace regular shapes the other way around. A five-pointed star uses five equal moves and 144-degree turns. Its turns total 720 degrees, or two full turns. Use the 360-degree rule for one trip around a regular shape's outside edge.

Key Takeaways

  • Pen down draws during moves; pen up lets you travel without drawing.
  • A move draws a side; a turn changes the facing direction.
  • One trip around a regular shape uses one repeat per side.
  • Divide 360 degrees by the number of sides to find its turn.
  • The turn is a change in direction, not the inside corner.
  • The move length changes the size.

2.2 Build a repeating line, beat or number path

The core of a pattern is the part that repeats. Your loop holds that core. You can repeat lines, sounds or equal jumps on a number line.

Leave a gap after every dash

Start facing right. This loop makes a dashed line:

repeat 5
    pen down
    move 20 steps
    pen up
    move 20 steps

One round draws a 20-step dash, lifts the pen, then moves through a 20-step gap. Each round travels 40 steps. Five rounds make five dashes and travel 200 steps, including the final gap.

Put pen down inside the loop. If it sits only above the loop, the first dash appears. Then pen up leaves the pen raised for all the later rounds.

Repeat one stair

With the pen down and the sprite facing right, try:

repeat 4
    move 30 steps
    turn left 90 degrees
    move 30 steps
    turn right 90 degrees

One round goes right, turns upward, moves up, then faces right again. The opposite turns get the sprite ready for another stair. Four rounds take it 120 steps right and 120 steps up. The total path is longer because it includes both the across and upward moves.

Hear the core

A beat of "drum, drum, cymbal" has three sounds. Repeating that core four times gives eight drums and four cymbals. You hear 12 sounds altogether. Keep all three sound blocks inside and keep their order.

Jump along a number line

Start at 0. Repeat a jump of 3 five times. The landings are 3, 6, 9, 12 and 15. This is skip counting: adding the same number each time.

The jumps make five equal groups of three:

3+3+3+3+3=15

Changing the repeat number changes how many jumps you take. Changing the jump size changes the distance each time. A loop drawing two dots on each of four rounds gives four equal groups of two dots.

To build your own pattern, sketch or say it first. Circle the core and count its copies. Put the whole core inside a repeat block. Run it and compare what you see or hear with your plan.

Key Takeaways

  • The loop's inside blocks make the pattern's core.
  • A dashed-line loop must lower and lift the pen each round.
  • Opposite quarter turns let a stair end facing the starting way.
  • Equal number jumps show skip counting and equal groups.
3

Put a loop inside a loop

A square can be one small part of a bigger picture. You will put one loop inside another, follow the inner loop through each outer round and count its actions. Then you will repeat whole shapes, moving or turning between copies to make a row or flower.

3.1 Count a loop inside a loop

A loop can hold another loop. The inside one finishes all its rounds every time the outside one reaches it.

Name the two loops

A nested loop is a loop inside another loop. The outside one is the outer loop. The one inside is the inner loop. Nested repetition is another name for this arrangement.

Read this from the outside inward:

repeat 3
    repeat 2
        clap
    stomp

The outer loop has three rounds. In each round, the inner loop claps twice. After that inner loop finishes, the sprite stomps once. Then the next outer round begins.

Trace one outer round per row
Outer roundWhat happens
1Clap, clap, stomp
2Clap, clap, stomp
3Clap, clap, stomp

Count the claps as three groups of two:

2+2+2=6

That is also three times two. Adding the loop numbers would give five, but it misses a whole group. The inner loop starts again in every outer round.

The stomp runs three times. It sits inside the outer loop, after the inner loop. It does not belong to the inner loop. Six claps and three stomps make nine actions altogether.

Follow the block shapes

In a block editor, look at the two C-shaped gaps. In written code, look at the spaces before each line. The clap sits farther inward than the stomp.

Move the stomp inward beside the clap, and the inner group becomes "clap, stomp." That group runs twice per outer round. Across three outer rounds, you now get six claps and six stomps.

Decide whether nesting helps

Two outer rounds, each with three claps inside, give six claps. A single repeat 6 around clap gives the same action list. Nesting is useful when you want to show groups within groups, or do another action after each inner group. You could also write repeated actions directly inside one loop. Choose a version whose groups you can read and check.

Key Takeaways

  • The inner loop finishes all its repeats on each outer round.
  • For one block inside both loops, multiply the two repeat numbers.
  • A block in only the outer loop runs once per outer round.
  • Tracing one outer round per row keeps the groups clear.
  • Moving a block into the inner loop can change its count.

3.2 Repeat whole shapes in a design

Once you have a working shape, you can make copies with an outer loop. A move or turn between copies changes where the next shape goes.

Test one shape first

Build a square loop with four equal moves and four 90-degree turns. Lower the pen before drawing. Test that it returns to its start, facing its starting direction.

Turn squares into a flower
pen down
repeat 8
    repeat 4
        move 50 steps
        turn right 90 degrees
    turn right 45 degrees

The inner loop draws one square. After it finishes, the 45-degree turn points the sprite toward the next square. This extra turn belongs inside the outer loop, after the inner loop.

The eight copies share one starting point. Their extra turns make one full turn:

8×45=360

The move inside the square runs four times per square. Eight groups of four give 32 moves. The 90-degree turn also runs 32 times. The extra 45-degree turn runs only eight times.

If you remove that extra turn, every square follows the same lines. You see one square drawn over eight times. If you keep the 45-degree turn but make only six copies, the extra turns total 270 degrees. The design leaves part of the full turn unfinished.

Move copies into a row

Start facing right with the pen down:

repeat 3
    repeat 4
        move 40 steps
        turn right 90 degrees
    pen up
    move 60 steps
    pen down

Each square returns to its own start. The sprite then travels 60 steps right without drawing. Each square is 40 steps wide, so the next square starts after a 20-step gap. The sprite also makes that pen-up move after the last square.

For copies around one point, share 360 degrees between the copies. Six copies need a 60-degree turn between them. Four squares with a 90-degree turn between copies make a window-like design.

Count the saved blocks

The flower's drawing part uses five visible blocks: two repeats, one move and two turns. The long version uses eight square instructions per copy, plus an extra turn:

8×8+8=72

Including the starting pen down gives 73 blocks for the long version and six for the nested version.

Key Takeaways

  • Test the inner shape before adding an outer loop.
  • Put the move or turn between copies after the inner loop.
  • For evenly spaced copies around a point, divide 360 by the copy count.
  • Lift the pen for a move that should leave no connecting line.
4

Keep things going with forever loops

A spinning fan and a bird in a game may keep moving for a long time. You will choose whether their actions need a count or should keep repeating. Then you will combine costume changes, small moves and short waits to make an animation you can see.

4.1 Choose when the repeating should end

Some jobs have a finish. Others keep running while your program is on. Choose a loop that matches what you want to happen.

A count or no count?
Repeat with a numberForever
Runs a set number of roundsHas no repeat number
Finishes after its last roundKeeps going until the program is stopped
Useful for four sides or three jumpsUseful for ongoing spinning or blinking

A forever loop is also called an infinite loop. It repeats the inside blocks without finishing by itself. You can stop the program with its stop button.

A windmill can keep spinning with this loop:

forever
    turn right 5 degrees

For exactly one full turn, use 72 repeats of that turn. The turns total 360 degrees. After its last turn, the count-controlled loop finishes.

Put starting steps first

A forever loop never reaches an ending. Blocks below it in the same script cannot start. Many block editors give it a flat bottom, so you cannot attach another block underneath.

If a fan should say "Starting!" before spinning, place that message above the forever loop. If it should spin a set number of times and then say "Finished!", use a count-controlled loop.

Using forever to draw a square keeps drawing over the same four sides. It never moves on to the next part of that script. Use four repeats when the drawing should end after one square.

Other scripts can still run

A script is a connected stack of instructions. A forever loop keeps its own stack busy. Another stack with its own start block can run at the same time. A game can keep music playing in one script while another script moves a character.

A planned forever loop is useful. It becomes a bug when endless repeating stops the program from doing the job you wanted.

Key Takeaways

  • Use a number when the job needs a set number of rounds.
  • Use forever for actions that keep going until you stop the program.
  • A forever loop cannot finish and reach later blocks in its script.
  • A separately started script can run alongside a forever loop.

4.2 Make a sprite look alive

A sprite can change pictures while it moves. Repeating those small changes can make a bird flap or a character walk.

Pictures become movement

Animation shows pictures one after another so something seems to move. A sprite's costumes are its different pictures. Give a bird one costume with wings up and another with wings down.

forever
    next costume
    wait 0.2 seconds

next costume switches to the next picture. After the last costume, it goes back to the first. The short wait lets you see each picture. The two bird pictures keep taking turns until you stop the program.

Wait inside the loop

A computer runs blocks very quickly. Costume changes with no pause can be too fast to follow. A wait above a loop pauses only before the animation. A wait below a fixed repeat pauses only after it. Put the wait inside so it happens after every change.

A longer wait slows the changes. A shorter wait speeds them up. Try changing only that wait and watch the difference.

Move in small steps
repeat 10
    move 10 steps
    wait 0.1 seconds

Ten small moves travel 100 steps altogether. The ten waits add up to one second, so the movement takes about a second. A single move 100 steps jumps there at once.

For a walking character, put a small move, next costume and a short wait inside the loop. Bigger moves cover more ground each round; smaller moves cover less. Keep the wait the same when comparing them. A built-in edge-bounce block inside the loop can make the character turn back at the screen edge.

Plan what happens

A storyboard is a few quick drawings of your animation. Sketch the start, a repeating part and an ending. Mark which pictures keep coming back.

Choose forever for a bird that flaps throughout the game. Choose a fixed repeat for a ball that rolls through ten small moves, then stops. A storyboard helps you choose the loop before you start dragging blocks.

Key Takeaways

  • Costumes are different pictures of a sprite.
  • A short wait inside the loop makes each costume easier to see.
  • Small moves with waits show a journey over time.
  • A longer wait slows an animation.
  • Sketch a storyboard and choose whether the action should end.
5

Predict, test and fix loops

Before you run your blocks, work out what you expect to see and hear. You will trace loops, count their actions and compare your prediction with a test. When something goes wrong, the result gives you clues. You will use those clues to make one repair at a time.

5.1 Work out the result before you run

You can read a program like a set of directions. Predicting means saying what it will do before you press start.

Trace from the top

Read any starting blocks first. Find the loop's count, or notice that it says forever. Trace the inside blocks once in order. Then count all the rounds and include any blocks after a fixed repeat.

Try this program:

say "Listen!" for 1 second
repeat 3
    play bell sound
repeat 5
    play woodblock sound

The loops are one after the other. The sprite says "Listen!" once, plays three bells, then plays five woodblocks. The second loop starts when the first finishes. There are eight sounds altogether.

Write every action when you need to

Unrolling makes the repeats visible. For repeat 2 around move 15 steps and say "Hello!", write:

"Move 15, say Hello!, move 15, say Hello!"

Now count two moves and two messages. The total distance traveled is 30 steps. Keep an action's place in the list; all the moves do not happen before all the messages.

For nested loops, write one outer round per row. If each row has three moves and one turn, two outer rounds give six moves and two turns. Multiply the move count by the length of each move to find the distance along the whole path.

Predict a change too

Changing a square's repeat number from four to eight keeps the move and turn the same. Eight quarter turns make two full turns. The sprite draws the same square twice. The final picture can hide the extra work.

Write a prediction before running. Then watch the actions, as well as the finished picture. If they differ from your prediction, check both the code and your counting. Either one may need fixing.

Key Takeaways

  • Read the start, every loop round and the ending in order.
  • Use an action list or rows to keep track of repeats.
  • The final picture can hide lines drawn more than once.

5.2 Find the first thing that goes wrong

A bug makes your program do something you did not want. Debugging means finding and fixing it. Watching carefully gives you clues about which block to change.

Compare the plan and the result

First say what should happen. Run the program and describe what really happens. Look for the first point where those two stories split.

A loop meant to draw a hexagon says:

repeat 5
    move 60 steps
    turn right 60 degrees

It draws five sides and leaves a gap. The turn is right for a hexagon, but there should be six sides. Change only repeat 5 to repeat 6. The six turns total 360 degrees. Run it again to check that the path closes.

Match the clue to the block
What you noticeWhat to check
Too many or too few actionsThe repeat number
One long line instead of a squareIs the turn inside the loop?
A message appears every roundShould the message be below the loop?
A triangle stays openDoes the turn say 120 degrees?
Costume changes are too fast to seeIs a short wait inside the loop?
A later action never startsIs a forever loop keeping that script busy?
Nothing is drawnIs the pen down before the moves?
Only the first dash appearsIs pen down inside the dashed-line loop?

Old lines can also hide your new drawing. Clear the screen at the start, then place the sprite at its starting spot and face it the starting way.

Slow the loop down

Add wait 0.5 seconds inside a loop while testing. Count rounds aloud as you watch. You may spot a turn happening once at the end when it should happen each round. Remove the extra testing wait when you have found the bug.

Test one change at a time

Change one block or number, then run again. Changing the count, turn and move all at once makes it hard to tell which change helped.

After the repair works, try another starting spot with enough room. Try a bigger shape too. Reset the start and clear old marks for each test. Check the side lengths, turns and ending, so the fix works beyond your first run.

Key Takeaways

  • Compare what should happen with what actually happens.
  • Find the first place where the program goes wrong.
  • Use the result as a clue about the count, placement, turn, wait or pen.
  • Change one thing and run again.
  • Slow a loop with a testing wait when its actions are hard to follow.
  • Retest with another size or starting spot.

Loops in Coding examples

5 Walkthroughs

1

Turn a dance into a loop

12 steps
Find a repeating group, follow it through a loop and count the blocks you save.
  1. 1
    IntroductionA shorter way to give directions

    Imagine teaching a robot a short dance. You could list every action, or find a group that comes back again. A loop in a repeat block does that for you, so you use fewer blocks and make a change in one place.

    You will mark that group, give it a repeat count and check the order. Then you will compare the robot's actions with the blocks you built.

  2. 2
    ExplanationMark the matching group

    Read this dance: "reach, tap, tap, reach, tap, tap, reach, tap, tap."

    The smallest matching group is "reach, tap, tap." Mark a line after each copy. There are three copies of the group, with three actions in each. The repeat count is the number of copies.

  3. 3
    ExampleKeep the opening outside

    Add "wave" before that dance. The wave happens once; the group "reach, tap, tap" still happens three times.

    The short directions are "wave, then repeat three times: reach, tap, tap." The opening wave belongs before the loop. It is not part of its repeating group.

  4. 4
    ChallengeFind the dance ending

    The dance is "hop, nod, hop, nod, hop, nod, bow." What is the smallest repeating group, how many copies are there, and what stays after it?

    ---reveal---

    "Hop, nod" repeats three times. The bow stays after the loop and happens once. Six counts the actions inside the groups, not the number of groups.

  5. 5
    ExplanationLook inside the C shape

    A repeat block holds the instructions that run again. Its number tells you how many rounds to do.

    The inside blocks run from top to bottom. After the last inside block, the loop returns to the first inside block for another round. After its last round, the script continues below it.

  6. 6
    ExampleStart before the repeats

    Build this dance:

    say "Watch!" for 1 second
    repeat 3
        reach
        tap
    say "Your turn!" for 1 second
    

    The sprite first says "Watch!" once. That block sits above the loop, so it runs before any reach or tap. The message below is still waiting for the loop to finish.

  7. 7
    ExampleFollow the three rounds

    Inside the loop, round one is "reach, tap." Round two is "reach, tap." Round three is "reach, tap."

    You get three reaches and three taps. Only then does the sprite say "Your turn!" The loop repeats its whole inside group; it does not run three reaches first and then three taps.

  8. 8
    ChallengeMove the ending message

    In that dance, you drag say "Your turn!" inside the loop after tap. How often does it run now, and when?

    ---reveal---

    It runs three times, after the tap on each round. Moving the block changed its place from a one-time ending to part of the repeated group.

  9. 9
    ExampleCount blocks, then actions

    Four copies of "reach, tap" need eight visible action blocks. A repeat block with one reach and one tap inside needs three visible blocks.

    8−3=5

    You save five blocks. The robot still does eight actions when it runs. A block can run several times while appearing only once in your stack.

  10. 10
    TipMake the change once

    Want every reach to become a jump? Change the reach block inside the loop. Every round now uses jump.

    With copied groups, you would need to change each copy. A short comment, such as "dance steps," can remind you what a loop does. The computer ignores comments when it runs.

  11. 11
    ChallengeBuild and check a shorter dance

    A long dance has "wink, clap" five times, then one bow. How many visible blocks does a loop version need? Unroll its first two rounds.

    ---reveal---

    It needs four blocks: repeat, wink, clap and the bow below. The first two rounds are "wink, clap, wink, clap." The bow happens only after all five rounds.

  12. 12
    RecapCheck your own dance

    Mark your repeating group and count its copies. Follow the inside blocks in order, then include any ending.

    When you shorten a stack, unroll it to check that every action still happens where you wanted it.

2

Draw a tile and build a pattern

13 steps
Follow moves, turns and pen changes to draw shapes and repeating patterns.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionGive the pen a path
  2. 2
    ExplanationGet the drawing ready
  3. 3
    ExampleDraw the first tile side
  4. 4
    ExampleFollow the next two sides
  5. 5
    ExampleClose the tile
  6. 6
    Key InsightShare the full turn
  7. 7
    ChallengeChoose the hexagon loop
  8. 8
    TipTurn outside the corner
  9. 9
    ExamplePlan one dash and gap
  10. 10
    ExampleCount the whole path
  11. 11
    ConnectionCount groups you hear or jump
  12. 12
    ChallengeRepair the dashes and count them
  13. 13
    RecapCheck the path and the marks
3

Build groups inside groups

12 steps
Trace nested actions, then use two loops to make repeated shapes.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionRepeat a whole small job
  2. 2
    ExplanationName the outside and inside
  3. 3
    ExampleRead one outer round
  4. 4
    ExampleFinish the second group
  5. 5
    ChallengeMove the whistle inward
  6. 6
    TipMake rows for the outer rounds
  7. 7
    ExampleBuild one triangle first
  8. 8
    ExampleTurn between triangles
  9. 9
    Key InsightKeep the two turns apart
  10. 10
    ConnectionPut copies in a row instead
  11. 11
    ChallengePlan a flower of triangles
  12. 12
    RecapFollow the jobs at each depth
4

Make a lantern sprite blink

9 steps
Choose a loop and use costume changes with pauses to build an animation.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionPlan the repeating pictures
  2. 2
    ExplanationChoose a count or forever
  3. 3
    Key InsightPlan the starting message
  4. 4
    ChallengeGive the blinking an ending
  5. 5
    ExampleShow each picture long enough
  6. 6
    TipChange the pause to change the speed
  7. 7
    ExampleAdd a small move each round
  8. 8
    ChallengeRepair and finish the lantern
  9. 9
    RecapSketch the animation before building
5

Find the bug from the result

11 steps
Predict a loop, compare its actions with your plan and test one repair at a time.

Save this lesson to follow every Walkthrough step by step.

  1. 1
    IntroductionUse a prediction as your check
  2. 2
    ExamplePredict separate loops in order
  3. 3
    ChallengeTrace a nested path
  4. 4
    Key InsightWatch the work behind the picture
  5. 5
    ExplanationCompare two clear descriptions
  6. 6
    ExampleRepair the count
  7. 7
    ExampleRepair the place
  8. 8
    TipCheck the pen at the first missing mark
  9. 9
    ChallengeUse the first wrong result
  10. 10
    ConnectionTry the repair in another case
  11. 11
    RecapKeep a short test record

Loops in Coding practice questions

40 Practice Questions in 4 sets

Set 1: Find and follow repeating steps10 Practice Questions

Question 1 of 10

A dance goes "nod, click, nod, click, nod, click, nod, click." How many copies of the smallest repeating group are there?
  1. 2 copies
  2. 4 copies
  3. 6 copies
  4. 8 copies
Show answerHide answer
Answer: B
The group "nod, click" appears four times. Eight counts all the individual actions, but the repeat number counts whole groups. Each group contains two actions.

Question 2 of 10

A robot follows "wave, forward, left, forward, left, forward, right." You put the repeated "forward, left" group in one loop. What stays outside it?
  1. "Wave" before; "right" after
  2. "Wave" before; "forward" after
  3. Nothing before; "forward, right" after
  4. "Wave" before; "forward, right" after
Show answerHide answer
Answer: D
The group "forward, left" matches twice. The first wave stays before the loop, and the different ending "forward, right" stays after it. Leaving only "right" after the loop would lose the final forward move.

Question 3 of 10

What does the sprite do after the greeting?

say "Hello!" for 1 second
repeat 2
    hop
    turn left
  1. Hop, turn left, hop, turn left
  2. Hop, hop, turn left, turn left
  3. Hop, turn left, turn left, hop
  4. Hop, turn left, hop
Show answerHide answer
Answer: A
Each round runs hop followed by turn left. Two rounds give that pair twice, keeping its order. Doing both hops before both turns groups matching actions together, which the loop does not do.

Question 4 of 10

How many chime sounds does this program play?

repeat 7
    play chime sound
    play chime sound
play chime sound
  1. 9 chimes
  2. 14 chimes
  3. 15 chimes
  4. 21 chimes
Show answerHide answer
Answer: C
Each of the seven rounds plays two chimes, giving 14 inside the loop. The chime below adds one more, for 15. Counting only 14 misses the block that runs after the loop finishes.

Question 5 of 10

A long stack has five copies of "move, tap, turn." A shorter version has one repeat block with that group inside. How many visible blocks does it save?
  1. 10 blocks
  2. 12 blocks
  3. 11 blocks
  4. 14 blocks
Show answerHide answer
Answer: C
Five copies of three blocks need 15 visible blocks. The loop version needs four: one repeat block and three inside blocks, saving 11. A saving of 12 forgets to count the repeat block itself.

Question 6 of 10

Your square loop already draws four equal sides with 90-degree turns. What change makes a larger square?
  1. Increase each move length.
  2. Increase the turn amount.
  3. Increase the repeat count.
  4. Decrease the turn amount.
Show answerHide answer
Answer: A
Longer moves make each side of the square longer. Keep four repeats and the quarter turns to keep its shape. More repeats trace extra sides along the same path instead of making the sides longer.

Question 7 of 10

A sprite must make one trip around a regular octagon. What repeat count and turn does it need?
  1. 4 repeats, 90-degree turns
  2. 8 repeats, 90-degree turns
  3. 4 repeats, 45-degree turns
  4. 8 repeats, 45-degree turns
Show answerHide answer
Answer: D
An octagon has eight sides, so it needs eight rounds. Sharing 360 degrees between eight turns gives 45 degrees each. Eight rounds with 90-degree turns would trace a square twice instead of an octagon.

Question 8 of 10

A sprite starts at 0 on a number line and makes four forward jumps of 7. Where does it finish?
  1. 11
  2. 28
  3. 21
  4. 35
Show answerHide answer
Answer: B
The landings are 7, 14, 21 and 28. Each round adds another seven, so the sprite finishes at 28. Adding four and seven gives 11, but four tells you the number of jumps, not another jump size.

Question 9 of 10

A toy character should bow exactly five times and then say "Thank you!" What loop fits the bows?
  1. A repeat block set to 5
  2. A forever loop around the bow
  3. A repeat block set to 6
  4. A repeat block set to 1
Show answerHide answer
Answer: A
Five repeats run the bow five times, then finish so the message can run. Forever keeps bowing and cannot reach a later message in the same script. One repeat would give just one bow.

Question 10 of 10

This should draw one square, then say "Made it!" once. What repair makes both parts work?

pen down
repeat 4
    move 35 steps
    say "Made it!" for 1 second
turn right 90 degrees
  1. Move both the message and turn inside.
  2. Move the turn inside; increase repeats to 5.
  3. Move the turn inside; move the message below.
  4. Move the message below; keep the turn below.
Show answerHide answer
Answer: C
The sprite needs a turn after every side, so the turn belongs inside the loop. The message belongs below, where it runs once after the square. Moving only the message fixes its count but leaves the sprite drawing one straight path.
Set 2: Follow nested groups and drawing patterns10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

What is the first complete outer round of this program?

repeat 5
    repeat 2
        play bell sound
    play click sound
  1. Bell, click
  2. Bell, click, bell, click
  3. Bell, bell
  4. Bell, bell, click
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

How many claps and stamps happen?

repeat 4
    repeat 5
        clap
    stamp
  1. 9 claps and 4 stamps
  2. 20 claps and 4 stamps
  3. 20 claps and 20 stamps
  4. 5 claps and 4 stamps
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A sprite draws one square, returns to its start and faces the starting way. An outer loop repeats it six times, with no extra move or turn. What appears?
  1. Six squares in a row
  2. Six squares around a point
  3. One square traced six times
  4. One square traced once
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A sprite tries to draw a regular triangle with three equal moves and a 60-degree right turn after each. What turn should replace 60 degrees?
  1. 120 degrees
  2. 90 degrees
  3. 180 degrees
  4. 60 degrees
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A sprite faces right. Each round draws a 9-step dash, then travels through a 6-step gap with the pen up. How far does it travel in six rounds, including the last gap?
  1. 54 steps
  2. 90 steps
  3. 36 steps
  4. 84 steps
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

Mia wants five 10-step dashes with 4-step gaps. Only the first dash appears. What single change fixes the dashes, and how far should the sprite travel, including the final gap?

pen down
repeat 5
    move 10 steps
    pen up
    move 4 steps
  1. Move pen up below the loop; 70 steps.
  2. Add pen down after the loop; 70 steps.
  3. Change the count to 10; 140 steps.
  4. Move pen down to the loop's start; 70 steps.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A bird has two different wing costumes. Its loop changes costume and waits 0.4 seconds each round. What makes the flapping slower?
  1. Change the wait to 0.8 seconds.
  2. Change the wait to 0.2 seconds.
  3. Remove the wait from the loop.
  4. Move the wait before the loop.
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

What sound order does this program produce?

repeat 2
    play woodblock sound
repeat 3
    play bell sound
  1. Woodblock, bell, woodblock, bell, bell
  2. Woodblock, woodblock, bell
  3. Woodblock, woodblock, bell, bell, bell
  4. Woodblock, bell, bell, bell, woodblock
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

Your animation changes costumes too quickly to follow. It already has a wait above the forever loop. What should you change?
  1. Lengthen only the wait above it.
  2. Add a wait after the forever loop.
  3. Put another next costume inside.
  4. Move the wait inside the loop.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

An outer loop draws three squares in a row. Each 28-step-wide square returns to its start facing right. After each square, the sprite lifts the pen and moves right. What move leaves 12-step gaps, and where does it finish relative to the first start, including the last pen-up move?
  1. Move 12 steps; finish 36 steps right.
  2. Move 40 steps; finish 120 steps right.
  3. Move 40 steps; finish 108 steps right.
  4. Move 28 steps; finish 84 steps right.
Show answerHide answer

Save this lesson to see this answer.

Set 3: Predict the effect of moving or changing blocks10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A loop repeats "tap, whistle" six times. You move the whistle below the loop. What happens now?
  1. Six taps and six whistles
  2. One tap and six whistles
  3. Six taps and one whistle
  4. One tap and one whistle
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

Your loop uses move, turn and sound blocks. You add a comment saying "draw and chime." What changes when it runs?
  1. The actions stay the same.
  2. The sprite says the comment.
  3. The sound plays once more.
  4. The loop gains another round.
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A loop draws an equal-sided triangle with side length 45 steps. You change only each move to 75 steps. What happens?
  1. It draws a square with longer sides.
  2. It adds a fourth triangle side.
  3. It draws the triangle twice.
  4. It draws a larger triangle.
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

A program repeats an outer group three times. Inside is repeat 4 with "tap," followed by "nod" outside the inner loop. You move nod inside beside tap. How many nods happen now?
  1. 3 nods
  2. 12 nods
  3. 7 nods
  4. 4 nods
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

How many sounds happen altogether?

play chime sound
repeat 3
    repeat 4
        play drum sound
    play bell sound
play chime sound
  1. 17 sounds
  2. 15 sounds
  3. 20 sounds
  4. 14 sounds
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

An outer repeat 10 holds a square-drawing loop, followed by turn right 36 degrees outside the inner loop. How many move blocks run, and how much do just the between-square turns total?
  1. 10 moves; 360 degrees
  2. 40 moves; 1,440 degrees
  3. 40 moves; 360 degrees
  4. 14 moves; 360 degrees
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

A fan should say "On!" once, then spin until the program is stopped. Where does the message go?
  1. Inside forever, before each turn
  2. Above forever, before it starts
  3. Inside forever, after each turn
  4. Below forever, after it ends
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

Two sprites use the same costume changes and 0.3-second wait. One moves 2 steps per round; the other moves 6. How does the second sprite travel?
  1. Slower, with shorter moves
  2. At the same speed, with longer moves
  3. Faster, with shorter moves
  4. Faster, with longer moves
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A sprite starts on costume A and has two costumes, A then B. What costume and total travel does this program end with?

repeat 5
    next costume
    move 4 steps
    wait 0.2 seconds
  1. Costume A; 20 steps
  2. Costume B; 20 steps
  3. Costume B; 4 steps
  4. Costume A; 4 steps
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

You change a loop's count, move length and turn together. The drawing now works. What is a better way to find which repair helped?
  1. Test one change at a time.
  2. Test them all from a new spot.
  3. Test them all more slowly.
  4. Test them all at a big size.
Show answerHide answer

Save this lesson to see this answer.

Set 4: Build, compare and repair loop designs10 Practice Questions

Save this lesson to see every answer and practice every set.

Question 1 of 10

A beat goes "tap, tap, bell, tap, tap, bell, tap, tap, bell, whistle." What repeats, and what happens after the loop?
  1. "Tap, bell" repeats 3 times; whistle follows.
  2. "Tap, tap, bell" repeats 3 times; whistle follows.
  3. "Tap, tap, bell" repeats 4 times; whistle follows.
  4. "Tap, tap, bell, whistle" repeats 3 times.
Show answerHide answer

Save this lesson to see this answer.

Question 2 of 10

A long stack has eight copies of a four-block group. A loop version keeps one copy inside one repeat block. How many visible blocks does the shorter version need?
  1. 4 blocks
  2. 8 blocks
  3. 5 blocks
  4. 32 blocks
Show answerHide answer

Save this lesson to see this answer.

Question 3 of 10

A sprite starts at 0 on a number line. Each loop round makes a forward jump of 8, then a forward jump of 3. After the loop, it makes one forward jump of 5. You change the loop count from four to six. Where does it finish now?
  1. 71
  2. 66
  3. 49
  4. 96
Show answerHide answer

Save this lesson to see this answer.

Question 4 of 10

You want six equally spaced closed shapes around one point. What extra turn belongs between copies?
  1. 30 degrees
  2. 45 degrees
  3. 90 degrees
  4. 60 degrees
Show answerHide answer

Save this lesson to see this answer.

Question 5 of 10

A design should have five equally spaced triangles around a point. Each triangle has three 120-degree turns. Where should turn right 72 degrees go?
  1. Inside the inner loop, before every move
  2. Below both loops, after the design
  3. Instead of each inner 120-degree turn
  4. Inside the outer loop, after the triangle
Show answerHide answer

Save this lesson to see this answer.

Question 6 of 10

A game has two separately started scripts. One plays a repeating beat forever. The other moves a character 30 steps once. What happens to the character's script?
  1. It waits until the beat finishes.
  2. It can move while the beat repeats.
  3. It repeats its move with the beat.
  4. It stops the beat before moving.
Show answerHide answer

Save this lesson to see this answer.

Question 7 of 10

You sketch a sprite appearing, waving several times, then leaving. What is this animation plan called?
  1. A costume
  2. A comment
  3. A storyboard
  4. A trace table
Show answerHide answer

Save this lesson to see this answer.

Question 8 of 10

The pen is down. A sprite draws with repeat 12 around move 18 steps and turn right 90 degrees. What does it draw, and how many moves run?
  1. The same square 3 times; 12 moves
  2. One 12-sided shape; 12 moves
  3. The same square 3 times; 4 moves
  4. The same square 4 times; 12 moves
Show answerHide answer

Save this lesson to see this answer.

Question 9 of 10

A sprite runs its drawing moves, but no new lines appear. Old lines have been cleared, and the pen stays up throughout. What should you change first?
  1. Add a longer wait to each move.
  2. Increase the number of repeats.
  3. Lower the pen before drawing moves.
  4. Change every right turn to left.
Show answerHide answer

Save this lesson to see this answer.

Question 10 of 10

A design uses outer repeat 2 around inner repeat 3. Each inner round draws one 14-step dash, then moves through a 5-step gap. What result checks both the drawing and all the travel, including the final gap?
  1. 6 dashes and 84 steps of travel.
  2. 3 dashes and 57 steps of travel.
  3. 6 dashes and 109 steps of travel.
  4. 6 dashes and 114 steps of travel.
Show answerHide answer

Save this lesson to see this answer.

Stuck on your own question? Homework Help

Key Terms

44 Key Terms, each with its definition

A

Action order
The action order is the order in which instructions happen as a program runs, including repeated actions.
A fixed sound loop finishes before a second sound loop starts.
Animation
An animation shows pictures one after another so something seems to move, such as a bird flapping its wings.
Two wing poses shown in turn make the bird look as if it flaps.

B

Bug
A bug is a mistake in a program that makes it do something you did not want, such as repeating too many times.
A square loop with only three repeats leaves one side missing.

C

Comment
A comment is a note in a program for people to read. The computer ignores it when running the blocks.
A comment beside a drawing loop might say "makes one tile."
Copy
A copy in a repeated-shape design is one complete shape drawn by the inner loop during an outer round.
Three outer rounds draw three copies, even if they overlap.
Core
The core is the whole part of a pattern that repeats. Its steps keep the same order in every copy.
For "bell, tap, tap, bell, tap, tap," the core is "bell, tap, tap."
Costume
A costume is one of a sprite's pictures. Different costumes can show its arms, legs or wings in different positions.
A walking sprite can switch between two leg poses.
Count-controlled loop
A count-controlled loop runs its inside instructions a set number of times, then finishes.
Use a count-controlled loop when a robot should take exactly six steps.

D

Dashed line
A dashed line has short drawn lines with gaps between them. A loop can draw each dash and then cross a gap.
Lower the pen for a dash and lift it before moving through the gap.
Debugging
Debugging means finding and fixing bugs. You compare the plan with the result, change one thing and test again.
Move a misplaced turn inside the loop, then check the new drawing.

E

Efficient code
Efficient code does its job with fewer, clearer blocks, making the program easier for you to read and change.
One move inside a square loop lets you change every side in one place.
Equal groups
Equal groups have the same number of items or actions in each group. Each round of a fixed loop repeats its group.
Four rounds with three beats each make four equal groups of beats.
Expected result
The expected result is what you want or predict a program to do. Comparing it with the test helps you find bugs.
Your expected result might be one square followed by one chime.

F

Forever loop
A forever loop keeps repeating its inside blocks with no repeat count, until the program is stopped.
A forever loop can keep a fan turning while the program runs.
Full turn
A full turn goes all the way around through 360 degrees and ends facing the starting direction.
Six turns of 60 degrees add up to one full turn.

G

Gap
A gap is a space left without drawing between marks or shapes. Pen-up travel lets you leave that space.
Square starts 70 steps apart leave a 30-step gap for 40-step squares.

I

Infinite loop
An infinite loop is another name for a loop that keeps repeating without finishing by itself, such as forever.
A spinning game wheel can use an infinite loop on purpose.
Inner loop
The inner loop is the loop inside an outer loop. It starts its repeats again on each outer round.
An inner count of four can draw all four sides of one square.
Instruction
An instruction is a step that tells you or a computer what to do. A sequence puts instructions in order.
In a robot path, "move forward" is an instruction.

L

Loop
A loop is a part of a program that repeats instructions, such as moves, sounds or drawing steps.
You can use a loop to make a sprite hop several times.

N

Nested loop
A nested loop is a loop inside another loop. The inside loop completes its repeats on every outside round.
A loop drawing one shape can sit inside a loop making several copies.
Nested repetition
Nested repetition means repeating a group that itself holds a repeat. It lets you build groups within groups.
Two groups of five chimes can be shown with nested repetition.

O

Outer loop
The outer loop is the outside loop in a nested program. Each of its rounds runs the inner loop all the way through.
An outer count of seven makes seven complete groups from the inner loop.

P

Pen down
Pen down is an instruction that makes a sprite draw a line wherever it moves, until the pen is lifted.
Use "pen down" before the first move of your drawing.
Pen up
Pen up is an instruction that lets a sprite move without drawing, until the pen is lowered again.
Use "pen up" to move between two shapes without a connecting line.
Predict
To predict is to work out what a program will do before you run it, using the blocks and their order.
Predict the number of drumbeats before pressing start.

Q

Quarter turn
A quarter turn changes the facing direction by 90 degrees. Four quarter turns make one full turn.
After drawing each side of a square, the sprite makes a quarter turn.

R

Regular shape
A regular shape is a closed shape with equal sides and equal corners, such as a square or an equal-sided triangle.
Draw a regular pentagon with five equal moves and equal turns.
Repeat block
A repeat block wraps around other blocks and runs them a set number of times, in the same order each round.
Put a move and a turn inside one repeat block to draw a square.
Repeat count
A repeat count tells you how many rounds a loop runs. Each round does the whole inside group.
In a loop with two sound blocks inside, a repeat count of five runs both of them five times.
Repeated-shape design
A repeated-shape design is a picture made from copies of a shape, with moves or turns placing the copies.
A flower of squares turns between copies around one starting point.
Repeating pattern
A repeating pattern has a group of steps or items that comes again in the same order.
In "nod, tap, nod, tap," the group "nod, tap" comes twice.
Repetition (iteration)
Repetition, also called iteration, means doing the same instructions again. One round does the repeating group once.
A dance repeats "step, clap" each time you perform another round.

S

Script
A script is a connected stack of instructions. A forever loop keeps its own script repeating.
A second script with its own start can run while the first plays music.
Sequence
A sequence is a set of instructions in order. A fixed repeat finishes before the next instruction starts.
The sequence "wave, hop" gives a different dance from "hop, wave."
Skip counting
Skip counting means counting by the same amount each time, like repeated equal jumps along a number line.
Counting "5, 10, 15, 20" is skip counting by fives.
Stop button
The stop button is a control that stops the program, including actions running inside forever loops.
Use the stop button when you have watched enough of your spinning sprite.
Storyboard
A storyboard is a few quick drawings that plan what happens in an animation, including which actions repeat.
Sketch a ball's start, rolling part and finish before building its blocks.

T

Test
A test runs a program so you can compare what actually happens with what you wanted or predicted.
Test the loop again after changing the repeat number.
Test case
A test case is one situation you try when checking a program, such as a different size or starting spot.
After fixing a small square, try a larger square as another test case.
Trace
To trace is to follow instructions in the order they run, keeping track of their actions through every repeat.
Trace one outer round per row to keep nested groups clear.
Turn amount
The turn amount is how far a sprite changes direction, measured in degrees. Turning happens on the spot.
A triangle loop needs a turn amount of 120 degrees after each side.

U

Unroll
To unroll a loop is to write out every action it runs, in order, including every copy of its inside group.
Unroll a dance loop to compare its steps with your original dance.

W

Wait block
A wait block pauses a script for a set time. Inside an animation loop, it gives each picture time to be seen.
A wait after each costume change makes the changes easier to follow.

About this lesson

By StudeliReport a mistake

Make your own Study Materials

Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.

Get Started