Fifth Grade

Programming concept covered:

Sequence, Loops, Functions, Debugging

Time: 45-50 minutes

Lesson Materials

  • Chalk board, white board, etc.
  • Markers, chalk, etc.
  • Floor space
  • Kodable (web, desktop, iPad, or Android)
    Available at

Print Lesson Plan

Get a free teacher account


  1. Students will be able to explain what a programmer does.
  2. Students will be able to define sequence and explain how it relates to programming.
  3. Students will be able to define loops and explain why they are necessary to programming.
  4. Students will be able to use fractions, degrees, and programming language, including loops, to move a “robot” forward, spin, jump, and walk back.


  • Programmer: A person that writes the code (language) that tells the computer what to do.
  • Code: The language that programmers use and create to tell computers what to do. 
  • Sequence: Sequence is one of three basic flow control structures in programming, and is the very first concept a student must understand when learning to code. Also known as the order of events, a computer will execute commands exactly in the order or sequence they are written. As a programmer, it is important to make sure that the commands given to a computer are in the right sequence, otherwise, a program might not run as expected. 
  • Loops: Loops are one of three basic flow control structures in computer programming, and are an essential feature of every programming language because they enable programmers to run dynamic and complex processes using a small amount of code. Loops are commands that are used to repeat a portion of code until a process is complete, and are essential to many repetitive tasks commonly required in programming. 
  • Function: A function is a sequence of commands that can be reused together later in a program. Functions name the sequence of commands and dictate what code is executed. Functions also allow for separation of code, so we can easily use it again throughout a program.
  • Bug: An error or mistake in code syntax.
  • Debugging: The process of finding and correcting a mistake in code.

Direct Instruction (I do) 15 minutes

“Who do you think is smarter, you or a computer? Explain your answer giving reasons.”
Give students 1 minute to turn and discuss with their partner. Call on 3 quiet hands to share their answers.
“People are actually much smarter than computers. In fact, computers can’t do anything without the people who are telling them what to do. The people who tell computers what to do are called programmers.”

Record on the board or chart paper: A programmer is a person who uses code, or programming language, to tell a computer what to do.

T: “Can you share an example of something a programmer would make?”
Call on 3 quiet hands to share their answers. Most students will use games as the example, but try to help them make connections to other things programmers write code for (games, other programs you use at school, cars, airplanes, spaceships, iPads, phones).

“All of the games, programs, and things you just talked about are programs created by programmers who tell the computer what to do. Programmers use a special language called code, to create these things. Raise your hand if you think it would be fun to create a game or program a spaceship someday.”

Record on the board or chart paper:
Programming Language is the language, or code, that programmers use and create to tell computers what to do.

T: “Programmers use the code that they write to tell the computer EXACTLY what to do. They have to tell the computer what to do in the right order, or it won’t work correctly. This is also known as the order of events. A computer executes the commands (directions), exactly in the order or sequence they are written.”

ASK: “Can you think of a task you need to do in order to get the end result you want?”
Call on 2 quiet hands to share examples of ordered events.

“In programming, sequence makes the computer correctly carry out the directions to make the program work.”

Record on the board or chart paper: Sequence- the order that a computer executes the commands written by the programmer. The computer will follow the sequence exactly as it is written.

“Repetition is the process of repeating the same task- sometimes we repeat what we are doing when we want to save time and minimize mistakes. For example, we may copy and paste something on a computer instead of typing it out more than once. Programmers do this when writing their code to make things go faster or to make sure mistakes aren’t made. This is called a loop. In programming, loops are used to save time and make sure mistakes aren’t made in the code.”

Say and record: Loops are commands that are used to repeat a portion of code until a process is complete. Loops are essential to many repetitive tasks often required in programming.        

Functions are also used by programmers to make complex processes more simple. Functions are a defined rule that can be used anywhere in your code.”       

“Today, we are going to use our knowledge of sequence, loops, and functions to act like programmers and move a ‘robot’ together.”

Guided Practice Activity: Beginner: Fifth Grade

Students will act as programmers and apply basic knowledge of programming language and sequence to command a robot to move forward and jump.

Time: 20-25 minutes

Activity Materials

  1. Whiteboard, markers, smart board or writing area that everyone can see.
  2. It is ideal to have another adult be the robot, but a student would be another option if you don’t have a TA, assistant or room parent.
  3. Floor space for the robot to move and for students to sit.


Have students seated on at their desks or on the rug area. Explain that another teacher, student, or parent is a robot, and that they need instructions from a programmer. Review that computers aren’t as smart as people.

Explain that we want to program the robot to walk forward, jump, spin, and walk back to where they began facing the direction they started in. Demonstrate this for them.

The portion that will be used in the function is, “6 steps forward and turn.

”T: (Ask) “How do we walk?” (Acceptable response: with our feet, with our legs) Explain that we have to walk “right, left, right, left” so that we don’t end up in the splits. “We need commands to tell our robot to move their right foot and left foot, because our robot won’t know what to do without instructions.”

Write the commands on the board, and explain why they look that way. (circle to indicate which foot should stay still and arrow to indicate which leg to move)

T: (Ask) “What should we tell our robot to do first?” (Either right foot or left foot forward) Write the program under “our code” with all commands separated by commas. Ask for the second move.

T: (Ask) “Is this enough steps? How can we tell?” (students should want to test the code)

Chose a student to high-five the robot to activate it. The robot will take two steps forward and crash, then you can “rewind” it.

T: (Ask) “Oh no! Our robot crashed! Why did it crash?” (Because it needs more code to complete the program)

Based on how big the steps are, determine how many more steps need to be taken. Ask students how many more steps are needed. “If we’ve taken two steps and we need to take six, how many more do we need?” (4 more)

T: (Ask) “What is something we can use so that we don’t have to re-write these commands over and over again?” (a loop)

Put arrows around the commands you want to repeat indicating that they will be looped.

T: (Ask) How many times do we want these commands to repeat. Use this opportunity to make the connection to multiplication. Write “x3” next to the looped commands to tell the robot how many times they should loop.

T: After the robot is getting to the correct spot, ask “Now what do we want our robot to do?” (Turn around) “How are we going to tell it to turn around? What shape do we make when we spin?” (a circle) “And which directions can we spin? (left or right)

“Let’s use a circle and an arrow pointing right, to tell our robot to turn right, and a circle and an arrow pointing left to tell our robot to turn left. Now, which direction do we want our robot to turn?” (either left or right) Write the code, then test it again.

T: Instruct the “robot” ahead of time to do a complete turn instead of half a turn. When the robot does the turn incorrectly, ask, “Uh oh! What happened?” (Our robot turned too much) “Yes, we made a mistake. When you’re programming is it okay to make mistakes?” (Yes!) “That’s right! A mistake in your code is called a bug! And when we fix bugs in our code we are debugging.”

Use the opportunity to tie in to degrees of rotation. Be sure to make the change in your code by adding “180°” next to your spin command. When the code is corrected, continue.

T: (Ask) Are we going to repeat this section of code again? (Yes!) “Let’s name our function something so we can use it again later.” Decide on a name for the function as a class, put the entire section of code inside brackets: {CODE}, then write the name of the function next to it.

When it is time to jump, ask the students, “How many legs do we use to jump?” (they should say 2) Use 2 arrows pointing up to mean jump. Write the command and then add it to the code.  

After writing the jump command in your code. Ask students, “What we will write to reuse the walk 6 steps and turn 180° portion of our code?” (Our function!) Write the name of the function instead of writing the entire code again. Your code will look like this when complete.

Complete the program and run it.


Optional: If you have time, you can ask for a “replacement robot”, because yours is almost out of batteries. Choose a student to become the robot and run the program.

Check for Understanding / Informal Assessment

Time: 10 minutes

Ask the class each question. Give 30 seconds for students to think and then turn to share with their partner for 1 minute (Think, Pair, Share). Record answers on chart paper to hang for later reference.

Review programmer, programming language, and sequence.

  1. What is a programmer?
  2. What is an example of a program?
  3. How do computers or computer programs work?
  4. What is binary and why do we need it?
  5. What happens if we give the computer directions in the wrong order?
  6. What happens if a programmer forgets a step in their directions?
  7. What is a command?
  8. What is a sequence? Why is sequence important?

  9. What do programmers use to repeat portions of the code until a process is complete?
  10. What is an example of a process you may repeat to save time in real life?

Independent Practice

Smeeborg Sequence Sector, "1,2,3 Roll" (1.1-1.5) and "Buggy Basics" (1.6-1.10)

enter your email address and we'll deliver it to you right away!