CSP Parameters, Return, and Libraries - Lesson 1 - Parameters and Return Explore
CSP Parameters, Return, and Libraries - Lesson 1 - Parameters and Return Explore
Prompt:
“lemon”
makeCake 3
tiers flavor
“lemon”
Unit 7 Lesson 1 - Activity
tiers flavor
“lemon”
makeCake 3
Unit 7 Lesson 1 - Activity
tiers flavor
“lemon”
makeCake 3
“lemon
3
”
“lemon
”
3
Unit 7 Lesson 1 - Activity
“lemon
3
”
“lemon
”
3
Unit 7 Lesson 1 - Activity
“lemon”
makeCake 3
tiers flavor
“lemon”
“chocolate
makeCake 4
tiers flavor
”
Unit 7 Lesson 1 - Activity
“lemon”
costCake 3
tiers flavor
“lemon”
Parameters
Unit 7 Lesson 1 - Activity
tiers flavor
“lemon”
cakeCost 3
Unit 7 Lesson 1 - Activity
???????
Unit 7 Lesson 1 - Activity
“lemon
3 ”
3
“lemon
” What does it mean to
return total?
12
But what happens to
that value?
How is it stored?
Unit 7 Lesson 1 - Activity
lamvoon”
r
“fle
Let’s return to variable
baggies!
12
t
cakeCos
value can be stored in a
variable.
cakeCalculator
Unit 7 Lesson 1 - Activity
Console
Cake cost: 12
Unit 7 Lesson 1 - Activity
Do This: Create a cost calculator function for building the house you
created a function for earlier.
Takeaways
● Functions with parameters and return values help us simplify our code
● Functions can only return one value at a time
● A function can have:
○ No parameters and no return values
○ Parameters, but no return values
○ Return values, but no parameters
○ Parameters and return values
Unit 7 Lesson 1 - Wrap Up
Create a Cluster!
Let’s add the following three words into our AP CS Principles Unit Journal.
Create a vocabulary page within your journal, or use our digital template.
Start with the words, your initial definitions, and visual representations of the
words.
Argume
Parameter AP CSP
Unit
nt Return
Journal