Activity: Functions and Choruses

  1. Ask, “What are functions?”
    • Sample response: “Functions are pieces of code that can be repeated over and over, just like the chorus of a song.”
  2. Say, “We will be using the song 'Going on a Bear Hunt' to practice using functions.”
  3. Put students in groups of 2–3 and pass out the Bear Hunt Student Worksheet.
    • Ask groups to discuss things that they notice about the song. (Sample responses: “The lyrics of the song are not in the proper order,” or “Parts of the song repeat themselves.”)
    • Ask students to cut out the boxes in the Bear Hunt Student Worksheet and place the pieces of the song in order.
  4. Ask, “If I had asked you to write this entire song out by hand, it would take a very long time. What could we do to make the song shorter and faster to write?”
    • Sample response: “Label the parts of the song that repeat as Chorus. Therefore, after the first time they are used, you can simply write Chorus in place of those lyrics.”
  5. Say, “A chorus of a song and a function in coding are similar. A function is a piece of code that repeats, and a chorus is a part of a song that repeats. They can both be called upon without having to rewrite them each time.”