# 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… **Computer Science** | **Grade 7** *A free lesson plan from K12 Academics. Source page: https://lessonplans.k12academics.com/k12-lesson-g7-cs-functions.html* 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. **Copy link** works with Canvas, Schoology, Moodle and any other LMS — paste it in as a resource or assignment. ## 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. 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? ## The Functions Explorer Project this and tap each idea. Have students explore what a function is, why to use one, and how it works. ## 45 minutes, five moves Tap any phase to open the teacher moves and student actions. ### Hook — Don’t Repeat Yourself 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. ### Unplugged — Unplug It Students practice. #### 👩‍🏫 Teacher Moves - Write a “recipe” function together. - Give it an input. - “Call” it. #### 🎒 Student Actions - Write it. - Give input. - Call it. ### Use — Explore Functions Students use. #### 👩‍🏫 Teacher Moves - Send students to the Functions Explorer. - Note parameters and returns. - Note calling. #### 🎒 Student Actions - Tap each. - Note them. - Explain. ### Modify — Reuse It Students modify. #### 👩‍🏫 Teacher Moves - Call a function with new inputs. - Predict the outputs. - Explain reuse. #### 🎒 Student Actions - Call it. - Predict. - Explain. ### Create — Create 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. ## Built to the standards you report on Aligned to the CSTA K-12 Computer Science Standards and ISTE Standards for Students. Create procedures/functions to organize code and hide detail. Incorporate existing code and functions. Use variables and functions together. Computational Thinker. ## One lesson, every learner ### Multilingual Learners - Function “recipe” cards. - Sentence frame: “The function ___ does ___.” - Use a recipe analogy. ### Support & Access - Start with “call it by name.” - Use a simple example. - Focus on reuse. ### Stretch & Extend - Write a function with parameters. - Return a value. - Combine functions. ### What to gather - 📽️Projector / board - 🧰Recipe-function cards - 💻The Functions Explorer - 💻Coding tool (optional) - ✏️Pencils - 🎫Exit-ticket slips ### Key terms - **function**: a named, reusable block of code - **call**: to run a function by name - **parameter**: an input a function accepts - **argument**: the value passed to a parameter - **return value**: the result a function gives back - **reuse**: to use the same code again - **define**: to write a function - **procedure**: another name for a function ## Exit Ticket Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students. ### 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. ## Check your understanding **1. What does “function” mean?** - another name for a function - to run a function by name - the result a function gives back - a named, reusable block of code *(correct)* “function” means: a named, reusable block of code **2. Which word means: “to run a function by name”?** - procedure - define - argument - call *(correct)* “call” means: to run a function by name **3. What does “parameter” mean?** - a named, reusable block of code - the value passed to a parameter - the result a function gives back - an input a function accepts *(correct)* “parameter” means: an input a function accepts **4. Which word means: “the value passed to a parameter”?** - argument *(correct)* - parameter - reuse - function “argument” means: the value passed to a parameter **5. What does “return value” mean?** - an input a function accepts - the result a function gives back *(correct)* - a named, reusable block of code - the value passed to a parameter “return value” means: the result a function gives back **6. Which word means: “to use the same code again”?** - reuse *(correct)* - procedure - argument - define “reuse” means: to use the same code again ## Printable worksheet --- Full lesson page: https://lessonplans.k12academics.com/k12-lesson-g7-cs-functions.html All lessons: https://lessonplans.k12academics.com/