Parameters and Return ValuesActivities & Teaching Strategies
Active learning works for parameters and return values because students must physically pass data into functions and handle outputs to see why modular design matters. When learners test functions in real code, they immediately grasp the difference between arguments and parameters, and why returns promote reusability over printing.
Learning Objectives
- 1Design functions that accept multiple parameters to solve a given computational problem.
- 2Compare the output of functions when different arguments are passed to the same parameters.
- 3Evaluate the impact of using return values versus modifying global variables on code readability and maintainability.
- 4Analyze the flow of data into and out of functions to predict program behavior.
Want a complete lesson plan with these objectives? Generate a Mission →
Pair Programming: Parameter Practice
Pairs define three functions: one taking two numbers as parameters to return their product, one processing a list to return its sum, and one calculating average from multiple args. They write test calls with varied arguments and check outputs. Extend by chaining functions.
Prepare & details
Differentiate between arguments and parameters in function calls.
Facilitation Tip: During Pair Programming: Parameter Practice, circulate and ask each pair to verbalize how the argument values map to the parameter names before running the code.
Setup: Groups at tables with access to research materials
Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template
Small Groups: Function Chain Challenge
Groups receive starter code with global variables. They refactor into functions using parameters and returns, like a score processor that takes player data and returns rankings. Test chains where one function's output feeds another's input. Share successes.
Prepare & details
Design functions that accept multiple inputs and return meaningful outputs.
Facilitation Tip: During Function Chain Challenge, provide scaffolded examples first, then step back to let groups discover how return values enable chaining.
Setup: Groups at tables with access to research materials
Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template
Whole Class: Trace and Debug Relay
Project code with functions on the board. Class traces step-by-step as teacher calls functions with arguments, revealing parameter binding and returns. Students predict outputs in chat, then debug errors collectively.
Prepare & details
Evaluate the benefits of using return values over modifying global variables within functions.
Facilitation Tip: During Trace and Debug Relay, assign each student a small role in the trace so everyone contributes to the final output.
Setup: Groups at tables with access to research materials
Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template
Individual: Refactor Assignment
Students get code relying on globals. Individually rewrite using parameters and returns, test with five cases, and document benefits. Submit for peer review next class.
Prepare & details
Differentiate between arguments and parameters in function calls.
Facilitation Tip: During Refactor Assignment, require students to submit both the original and refactored versions to highlight the clarity gains from clean returns.
Setup: Groups at tables with access to research materials
Materials: Problem scenario document, KWL chart or inquiry framework, Resource library, Solution presentation template
Teaching This Topic
Start with concrete examples using familiar calculations, like distance between points, so students see parameters as inputs they control. Avoid abstract lectures on scope; instead, use live coding where you intentionally make mistakes with global variables and let students spot the risks. Research shows that students master returns faster when they experience the frustration of hard-to-debug globals in their own code.
What to Expect
By the end of these activities, students will confidently define functions with multiple parameters, call them with correct arguments, and use return values to chain operations without side effects. They will also debug functions by tracing parameter flow and justify when to return versus modify globals.
These activities are a starting point. A full mission is the experience.
- Complete facilitation script with teacher dialogue
- Printable student materials, ready for class
- Differentiation strategies for every learner
Watch Out for These Misconceptions
Common MisconceptionDuring Pair Programming: Parameter Practice, watch for students confusing arguments and parameters.
What to Teach Instead
Have pairs annotate their code with arrows from the call’s arguments to the definition’s parameters and label each side clearly before running the function.
Common MisconceptionDuring Function Chain Challenge, watch for students defaulting to printing results inside functions.
What to Teach Instead
Require groups to submit two versions of their code: one that prints inside the function and one that returns, then have them test how each integrates with the next function in the chain.
Common MisconceptionDuring Trace and Debug Relay, watch for students assuming return values automatically update global variables.
What to Teach Instead
In the relay, include a step where students must manually assign the return value to a variable and explain why globals are unnecessary in that scenario.
Assessment Ideas
After Pair Programming: Parameter Practice, display a function definition and call on the board. Ask students to write down the parameters and arguments, then predict the return value before running it to check their answers.
After Function Chain Challenge, have students submit a one-paragraph reflection on how return values made their function chain easier to debug compared to using globals or printing.
During Trace and Debug Relay, pause the activity and ask: 'Could this function work if it modified a global variable instead of returning a value? Why or why not?' Use their responses to transition into Refactor Assignment.
Extensions & Scaffolding
- Challenge students who finish early to design a function that accepts a list of coordinates and returns the perimeter of the polygon they form.
- For students who struggle, provide a partially completed function with blanks for parameters and a call example, asking them to fill in the missing parts.
- Deeper exploration: Ask students to compare the performance and readability of a function that returns a value versus one that prints, then present findings to the class.
Key Vocabulary
| Parameter | A variable listed inside the parentheses in a function definition. It acts as a placeholder for a value that will be passed into the function. |
| Argument | The actual value that is sent to a function when it is called. This value is assigned to the corresponding parameter. |
| Return Value | The value that a function sends back to the part of the program that called it. This is specified using the 'return' keyword. |
| Function Call | An instruction that executes the code within a defined function. It can include arguments that are passed to the function's parameters. |
Suggested Methodologies
More in Programming Paradigms and Syntax
Introduction to a Text-Based Language
Get acquainted with the basic syntax and structure of a chosen text-based programming language (e.g., Python, Java).
2 methodologies
Variables and Primitive Data Types
Learn how computers store different types of information and the importance of choosing the correct data structure for basic values.
2 methodologies
Operators and Expressions
Understand arithmetic, relational, and logical operators and how to combine them to form expressions.
2 methodologies
Input and Output Operations
Learn how to get input from users and display output, enabling interactive programs.
2 methodologies
Complex Data Structures: Lists and Arrays
Explore how to store collections of data using lists and arrays, and perform operations on them.
2 methodologies
Ready to teach Parameters and Return Values?
Generate a full mission with everything you need
Generate a Mission