Home›Lesson Plans›Computer Science›Computer Science · Grade 7

Functions in Code

Seventh graders learn about functions — reusable, named blocks of code that do a specific job — and how parameters and return values let one function work for many situations, keeping programs shorter and cleaner.

Grade 7Programming45 minutes1 class periodUse → Modify → CreateExplicit teaching4 StandardsCSTA
Start the Lesson
Assign or share this lesson

Copy link works with Canvas, Schoology, Moodle and any other LMS — paste it in as a resource or assignment.

Lesson at a Glance

Everything you need before the bell rings

Learning Objectives

Students will be able to…

  • ✓Define a function.
  • ✓Explain parameters and returns.
  • ✓Explain calling a function.
  • ✓Use a function.
Essential Question

Great coders don’t repeat themselves. Instead of writing the same code over and over, they package it into a function they can reuse. What is a function, and why is it so powerful?

0
Lesson Phases
0
Vocabulary Terms
0
Standards Aligned
0
Interactive Task
Explore · Interactive

The Functions Explorer

Project this and tap each idea. Have students explore what a function is, why to use one, and how it works.

🧰 Explore functions — tap eachTry it

The Lesson · Use → Modify → Create (a coding progression with Unplugged practice)

45 minutes, five moves

Tap any phase to open the teacher moves and student actions.

1

Hook — Don’t Repeat Yourself

5 min

Great coders don’t repeat code — they package it. How?

👩‍🏫 Teacher Moves

  • Show repeated code.
  • Ask for a shortcut.
  • Set the goal.

🎒 Student Actions

  • See it.
  • Wonder.
  • Predict.
2

Unplugged — Unplug It

10 min

Students practice.

👩‍🏫 Teacher Moves

  • Write a “recipe” function together.
  • Give it an input.
  • “Call” it.

🎒 Student Actions

  • Write it.
  • Give input.
  • Call it.
3

Use — Explore Functions

13 min

Students use.

👩‍🏫 Teacher Moves

  • Send students to the Functions Explorer.
  • Note parameters and returns.
  • Note calling.

🎒 Student Actions

  • Tap each.
  • Note them.
  • Explain.
4

Modify — Reuse It

12 min

Students modify.

👩‍🏫 Teacher Moves

  • Call a function with new inputs.
  • Predict the outputs.
  • Explain reuse.

🎒 Student Actions

  • Call it.
  • Predict.
  • Explain.
5

Create — Create

5 min

Students conclude.

👩‍🏫 Teacher Moves

  • Write a simple function.
  • Call it twice.
  • Complete the exit ticket.

🎒 Student Actions

  • Write it.
  • Call it.
  • Complete the exit ticket.
Standards Alignment

Built to the standards you report on

Aligned to the CSTA K-12 Computer Science Standards and ISTE Standards for Students.

CSTA
2-AP-14

Create procedures/functions to organize code and hide detail.

CSTA
2-AP-16

Incorporate existing code and functions.

CSTA
2-AP-11

Use variables and functions together.

ISTE
5

Computational Thinker.

Differentiation

One lesson, every learner

Multilingual Learners

ELL / EMERGING READERS
  • Function “recipe” cards.
  • Sentence frame: “The function ___ does ___.”
  • Use a recipe analogy.

Support & Access

IEP / 504
  • Start with “call it by name.”
  • Use a simple example.
  • Focus on reuse.

Stretch & Extend

GIFTED / EARLY FINISHERS
  • Write a function with parameters.
  • Return a value.
  • Combine functions.
Materials

What to gather

  • 📽️Projector / board
  • 🧰Recipe-function cards
  • 💻The Functions Explorer
  • 💻Coding tool (optional)
  • ✏️Pencils
  • 🎫Exit-ticket slips
Vocabulary

Key terms — hover for a quick definition

functiona named, reusable block of codecallto run a function by nameparameteran input a function acceptsargumentthe value passed to a parameterreturn valuethe result a function gives backreuseto use the same code againdefineto write a functionprocedureanother name for a function
Evaluate

Exit Ticket

Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students.

QUESTION 1
What is a function?
A named, reusable block of code that does a specific job.
QUESTION 2
What is a parameter?
An input you give a function so it works with different information.
QUESTION 3
Why do coders use functions?
To reuse code, save time, reduce mistakes, and keep programs organized.

Create: write a function.

Have students write (in plain language or code) a simple function like “greet(name)” and show how calling it with different names works. A printable functions sheet is in the Computer Science library.

Study · Flashcards

Study the key terms

Tap a card to flip it, then rate whether you knew it. Built from this lesson’s vocabulary.

🃏 FunctionsFlip
Card 1
Term
Tap to flip →
Meaning
0

Nice work!

Practice · Quiz

Check your understanding

A quick self-check with instant feedback, drawn from this lesson’s key terms.

📝 FunctionsQuiz
Score: 0
1 / 6
Question 1
0%

Nice work!

Practice · Worksheet

Printable worksheet

A print-and-go review sheet with a built-in answer key. Tap “Show answer key” to reveal answers, or print the clean version for students.

🖨️ FunctionsPrint
Name: ________________________
Date: ____________

Part A · Write the word that matches each meaning

Word bank: argument, call, define, function, parameter, procedure, return value, reuse
  1. the value passed to a parameter
  2. the result a function gives back
  3. to write a function
  4. a named, reusable block of code
  5. an input a function accepts
  6. to use the same code again
  7. another name for a function
  8. to run a function by name

Part B · Show what you learned

  1. What is a function?
  2. What is a parameter?
  3. Why do coders use functions?
Answer key — Part A: 1) argument · 2) return value · 3) define · 4) function · 5) parameter · 6) reuse · 7) procedure · 8) call
Part B: 1) A named, reusable block of code that does a specific job. 2) An input you give a function so it works with different information. 3) To reuse code, save time, reduce mistakes, and keep programs organized.