Tip:
Highlight text to annotate it
X
Unplugged Activity: Songwriting
You know how when you look up the lyrics for a song and they define the chorus at
the very beginning
and for the rest of the song they just refer you back to the chorus?
That's how you'd call a function. So, in this lesson
we define the chorus at the beginning of the song
and then we sing through our song and go back
and we noticed that the class doesn't sing the word "Chorus".
They automatically go up to the top where we define the chorus
and sing through that. We use that as a great introduction
to how to understand what a program is doing when it defines
and calls a function. We use familiar songs including Old MacDonald
to talk about how a chorus is called over and over and how sometimes
a chorus can change. When you have a song like old McDonald where certain words
change that's a great place to introduce the idea of parameters -
passing certain words through so that you can send
extra information to your function. Once we're sure everybody gets it
you can take your own familiar songs and break them up yourself
see if you can figure it out together.