Junior Coding Basics Badge Activity


Create a Handshake with Code

Explore algorithms and create your own handshake algorithm with nested loops

Download the Badge Requirements

Activity Details

Time needed: 20 minutes

Materials needed:


Have you ever read the directions on a shampoo bottle? They often say, “Apply shampoo to your hair. Lather, rinse, repeat.” “Lather” means “rub the shampoo around in your wet hair to make lots of bubbles.” “Rinse” means “use lots of water to wash the bubbles out.” And “repeat” means “do it all again!”

“Lather” and “rinse” are the steps in a hair-washing algorithm. An algorithm is a set of step-by-step instructions for how to do something. “Repeat” is a loop. It means “do the same step of the algorithm—lather and rinse—over and over again.”

“Lather” is a nested loop, because you need to rub the shampoo around on your head in lots of different places—on the top, on both sides by your ears, and in the back. You repeat—or loop—the process of lathering. That repeated action happens within the loop of washing your hair twice.

Programmers use loops to tell computers to repeat actions in their programs. Loops make programs shorter, easier to write, and easier for computers to understand.


For this activity, find a partner and use loops to create your own secret handshake.

First, follow the Looping Handshake Algorithm handout to do a fun handshake with your partner and see a loop in action! In the algorithm, the yellow shape says, “repeat two times.” This means you should repeat the actions inside of it two times. It’s a loop!

Then, decide with your partner about what kind of BFF handshake you want to make. Your handshake needs to use at least one loop to repeat at least one action. Write down your handshake, step by step, to create your own handshake algorithm.

Once you have an algorithm, test it out! Then, add more motions to your handshake algorithm, putting loops inside of other loops to create nested loops.

For example: If you want to repeat high-five, snap, snap, snap twice, use a loop for the three snaps and another loop to repeat the whole thing twice, like this: repeat twice (high-five repeat three times (snap)).

After you add nest loops to your algorithm, test it again.

And that’s it! Share your handshake algorithm with other people so they can join in the fun. Now you also know how to create an algorithm for something you can do every day!

Troop Leaders:  The instructions for all badge steps are available free of charge in your  Girl Scout Volunteer Toolkit.

Girl Scouts at Home activities have been adapted from existing Girl Scout programming and optimized for use at home during a period of social distancing.

Adapted from Step 2 of the Junior Coding Basics badge.