How To Explain Loops To Kids

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

How to Explain Loops to Kids

Sometimes we take for granted the ability to instruct someone to repeat an action,
rather than needing to tell them to perform each individual action. Imagine having to
tell someone, “Set this plate on the table, then set this plate on the table, then set
this plate on the table…” instead of simply saying, “Set the table for four.”

Computers require very specific instructions to perform their tasks: Unlike humans
having a conversation, computers can’t pick up information based on context, tone,
or body language.  To repeat an action a hundred times, it would require having to
write a hundred lines of code to repeat the action! Fortunately, there is a way to tell a
computer to repeat an action without writing a separate line of code for each
repetition. This concept is called a “loop”.There are two kinds of loops: “counting”
loops and “conditional” loops. Below are examples of activities you can do at home
to know both kinds of loops!

Counting Loops: Brushing Your Teeth

We use counting loops when we want to tell the computer to repeat an action a
certain number of times. Let’s take a look at how to apply counting loops to brushing
your teeth:

-Bring a whiteboard and marker (or paper and pen) into the bathroom when it’s time
for you to brush your teeth.

-Ask yourself: “What are the steps we have to follow when we brush our teeth?” Be
specific as you explain the various steps to your mom.

-Ask yourself: “Are there any steps we repeat?” Perhaps you will mention that we
should brush our tongue several times at the end of the routine.

-Tell yourself: “Pretend we’re writing instructions for someone who’s never brushed
their teeth before. We have to write each action by itself on a line. How would we tell
them to brush their tongue 3 times?” (Depending on your understanding level, you
can tell your mom to write down the answers while you give them. Remember that if
you write the answer yourself, you’ll be more likely to remember what you learn, so
it’s a good idea to write yourself as much as you can.)

-The end result should look like this:

           brush tongue
           brush tongue
           brush tongue
- Tell yourself : “Can we think of a word that means to do something more than
once?” (“Repeat”)

-Write yourself:  Repeat

- Tell yourself: “What action do we need to repeat?” (Brush tongue)

-Add “brush tongue” to your whiteboard:

           Repeat     

                   brush tongue

- Tell yourself “How many times do you brush your tongue?” (3)

-Add “[3 times]” to your whiteboard:

             Repeat [3 times]

                   brush tongue 

-Explain your mom that together with her, you just wrote a counting loop–a set of
instructions telling someone to repeat a sequence of actions.

-Just brush your teeth. Can you think of any other steps that you repeat? 

Conditional Loops: Dance Party!

A conditional loop is a loop that tells a computer to repeat a sequence of actions until
a condition is met. Follow these steps to know how to use conditional loops:

- Write the following instructions on a whiteboard:

        clap
        step left
        step right 

- Tell yourself: “We’re going to pretend we are computers, and these are our
instructions.”

- Tell yourself: “We need to keep performing these instructions over and over.”
(Repeat motions several times.)

- Tell yourself: “We need to know when to stop. We will stop when we’re tired.”

-Write yourself:
          Repeat [until I’m tired]

                 clap
                 step left
                 step right 

- Tell yourself: “Now we can dance and stop when we’re tired!”
- Tell yourself: “We just made a conditional loop. In computer languages, conditional
loops tell the computer to perform an action until something happens. In our case,
that ‘something’ is ‘until I’m tired.’ When that happens, I can stop dancing.”

-Dance until you get tired to reinforce your understanding of this concept!

You might also like