Close
Close full mode
logoMakeCode AP CSP

Introduction to Functions

Activity

A. Go to placeSprite.

B. Go to Activity: Functions Intro.

Complete Student Tasks 1a-1b.

Tasks

Task 1a

  1. Create three different functions.
  2. Call functions in on start.
  3. Comment your code.

Shared project link:

Task 1 Extension

Recreate code using JavaScript.

Shared project link:
β€―

Tasks 1b

  1. Create 2 new functions.
  2. Call functions in on A button pressed.
  3. Comment your code.

Shared project link:

Task 1b Challenge

Create an overlap event that uses:

  • the conversation function.
  • an additional, new function.

Shared project link:

Task 1b Extension

Recreate code using JavaScript.

Shared project link:

Extension activities

  1. Complete the problem set at Problem Set: Intro to Functions.
  2. You may use block or text based programming for the problem sets.
  3. Comment your code as your work.

Reflection/Homework

Describe how using functions in code can help make programming easier. Does putting code into separate functions always make sense? Would it be more or less clear if we took the code from our example (placeHuman, placeCow, and placeAsteroid) and made a function that calls the other three, so that our on start block only had a single block inside of it?

πŸ“˜ Unit 5 - AAP Part 2 β€” Previous
Intro to Functions
Next β€” πŸ“˜ Unit 5 - AAP Part 2
Day 2