# Functions & Parameters > Eighth graders learn to write functions — named, reusable blocks of code — and to pass in parameters so one function can handle different inputs, a key step… **Computer Science** | **Grade 8** *A free lesson plan from K12 Academics. Source page: https://lessonplans.k12academics.com/k12-lesson-g8-cs-functions.html* Eighth graders learn to write functions — named, reusable blocks of code — and to pass in parameters so one function can handle different inputs, a key step toward organized, powerful programs. **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 a **parameter**. - See why functions are **reusable**. - Write a function. Copying the same code over and over is a nightmare. Functions let you write it once and reuse it — and parameters make each use flexible. How do functions and parameters work? ## Functions Check Project each item and have students answer about functions. The tool explains functions, parameters, and reuse. ## 50 minutes, five moves Tap any phase to open the teacher moves and student actions. ### Hook — Write Once, Use Often Copying code over and over is a nightmare — functions fix that. How? #### 👩‍🏫 Teacher Moves - Show repeated code. - Introduce functions. - Set the goal. #### 🎒 Student Actions - Consider. - Meet them. - Predict. ### Unplugged — Unplug It Students practice. #### 👩‍🏫 Teacher Moves - Define a “recipe” function. - Give it a parameter. - Feel the reuse. #### 🎒 Student Actions - Define it. - Add input. - Feel it. ### Use — Functions Check Students use. #### 👩‍🏫 Teacher Moves - Send students to Functions Check. - Note parameters. - Explain reuse. #### 🎒 Student Actions - Answer. - Note it. - Explain. ### Modify — Modify It Students modify. #### 👩‍🏫 Teacher Moves - Add a parameter to a function. - Call it with new values. - Predict the results. #### 🎒 Student Actions - Add it. - Call it. - Predict. ### Create — Create Students conclude. #### 👩‍🏫 Teacher Moves - Write a function with a parameter. - Explain the reuse. - Complete the exit ticket. #### 🎒 Student Actions - Write it. - Explain 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 with parameters. Create clearly named variables. Incorporate existing code into programs. Computational Thinker. ## One lesson, every learner ### Multilingual Learners - Function + parameter cards. - Sentence frame: “A function ___.” - Use a recipe analogy. ### Support & Access - Start with “reuse code.” - Use one simple function. - Add one parameter. ### Stretch & Extend - Add return values. - Write several functions. - Refactor repeated code. ### What to gather - 📽️Projector / board - 📋Function cards - 💻Functions Check - 💻Coding tool - ✏️Pens - 🎫Exit-ticket slips ### Key terms - **function**: a reusable named block of code - **parameter**: an input to a function - **argument**: the value passed in - **call**: to run a function - **return**: a value a function gives back - **reuse**: using code again - **procedure**: another word for function - **input**: information given to code ## 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 describe a function with one parameter they could write for a program. A printable functions sheet is in the Computer Science library. ## Check your understanding **1. What does “function” mean?** - a reusable named block of code *(correct)* - information given to code - to run a function - another word for function “function” means: a reusable named block of code **2. Which word means: “an input to a function”?** - function - parameter *(correct)* - reuse - return “parameter” means: an input to a function **3. What does “argument” mean?** - a reusable named block of code - the value passed in *(correct)* - another word for function - using code again “argument” means: the value passed in **4. Which word means: “to run a function”?** - function - call *(correct)* - return - argument “call” means: to run a function **5. What does “return” mean?** - a value a function gives back *(correct)* - the value passed in - to run a function - another word for function “return” means: a value a function gives back **6. Which word means: “using code again”?** - call - input - reuse *(correct)* - return “reuse” means: using code again ## Printable worksheet --- Full lesson page: https://lessonplans.k12academics.com/k12-lesson-g8-cs-functions.html All lessons: https://lessonplans.k12academics.com/