Lesson 7: Functions

Often in programming, there are tasks or procedures that are used frequently within the same program. Rather than rewrite the lines of code that perform a particular task each time you need it, you can group that set of instructions together as a function. Grouping frequently used instructions as a function makes your code more efficient. You can write the set of instructions once as a function and from then on simply ‘call’ the function from inside your program whenever you need that task done. A function is usually given a name that describes the task it will perform when called, making your code easier to read, too!

* You can also watch this video here.

Lesson structure

  • Overview: Functions
  • Unplugged: PB & J
  • Minecraft Activity 1: Leap of Faith Mini-Game
  • Minecraft Activity 2: Zombie Pig
  • Minecraft Activity 3: Burger
  • Independent Project: Dream House
  • Assessment: Rubric
  • Standards: Listed

Lesson plan

  1. Overview: Functions
  2. Unplugged: PB & J
  3. Activity: Leap of Faith Mini-Game
  4. Activity: Zombie Pig
  5. Activity: Burger
  6. Independent Project

Flipgrid

The Flipgrid topic for the Functions lesson: https://flipgrid.com/174577c1

CSTA K-12 Computer Science Standards

Targeted standards for this lesson:

  • 2-AP-13 - Decompose problems and subproblems into parts to facilitate the design, implementation, and review of programs.
  • 2-AP-14 - Create procedures with parameters to organize code and make it easier to reuse.
  • 3A-CS-01 - Explain how abstractions hide the underlying implementation details of computing systems embedded in everyday objects.
  • 3A-AP-13 - Create prototypes that use algorithms to solve computational problems by leveraging prior student knowledge and personal interests.