Introduction

  1. Say, “Today we are going to learn about a new coding concept: functions.”
  2. “You use functions everyday for the routines in your life. Often, when you do things over and over, you don’t have to think about each separate part of the task; your body knows what to do automatically.” Discuss real-life examples of functions.
    • When you brush your teeth, you don’t think, “I’m going to put water on my toothbrush. I’m going to open the toothpaste. I’m going to put toothpaste on my toothbrush. I’m going to brush my front teeth. I’m going to brush my back teeth. I’m going to put water in my mouth and spit out the water and toothpaste into the sink.” Instead, you think, “I’m going to brush my teeth.” This is an example of a function.
  3. Watch Code.org’s video about functions: https://studio.code.org/s/coursee-draft/stage/6/puzzle/1.
  4. Say, “A function is when a part of a code is repeated and can be called throughout the program. Functions are used when you need to repeat a piece of code several times.”
    • Discuss examples of when you would want to use a function in a program (e.g., when you want Dash to perform the same dance at different times in the program).