Lesson 3.03: Return vs Print
Learning Objectives
Students will be able to…
- Define and identify: return, none
- Explain and demonstrate the difference between printing and returning
Materials/Preparation
- Do Now
-
Lab - War (Card Game) (printable lab document) (editable lab document)
- Associated Reading - section 3.3
- Read through the do now, lesson, and lab so that you are familiar with the requirements and can assist students.
- Note that this lesson may take two days.
Day 1 Pacing
| Duration | Description |
|---|---|
| 5 Minutes | Do Now |
| 10 Minutes | Lesson |
| 35 Minutes | Lab |
| 5 Minutes | Debrief |
Day 2 Pacing
| Duration | Description |
|---|---|
| 5 Minutes | Do Now |
| 40 Minutes | Lab |
| 5 Minutes | Debrief |
Instructor’s Notes
1. Do Now
- Students experiment with a function that returns a value, but they must add a print command to output that value.
2. Lesson
- Ask students about what they think the difference between returning and printing is.
Student Sharing
- Get a volunteer to describe how they rewrote the code in the Do Now to get a value output.
- Ask a student to write the code on the board.
Discussion
- Discuss the concept of the function contract again, explaining that the functions we will work with have both inputs and outputs.
- Returning is a concept in Snap!, just with a different name: reporting.

Building a Structure Activity
- One student volunteer represents the
give_cardfunction. - This students holds the deck of cards and stands by the board.
- On the board display the
give_cardfunction in code code that only prints the value of a randomly chosen card. - Students ‘call’ the student and request cards, which then the student follows the instructions and draws (‘prints’) the card on the board.
- Display a new
give_cardfunction that returns a card instead. - Have students ‘call’ the function, however this time have the
give_cardstudent pass out the card when a student calls him/her. -
- Debrief the activity and talk about what was learned.
3. Lab
- Given a shuffled deck list, students will create a program that plays the game ‘War’ with the user.
4. Debrief
- Check student progress and completion of the lab, wrap up by taking any final questions.
Accommodation/Differentiation
As an extension activity, ask students to research the shuffle function and the functions associated with it.
Forum discussion
Lesson 3.03: Return vs Print (TEALS Discourse Account Required)