17 Function Basics

How do functions help us simplify code?

Vocabulary

Return Value, boolean, parameter, arguments

Study Questions

  1. How are functions like LEGO bricks?
  2. How do parameters make functions more flexible?
  3. What is the difference between a parameter of a function and an argument of the function?
  4. What are return values? Do all functions need to return values?

Activity

  • Watch Video #1 (below)
  • This project is about self-expressions. Your task is to create a Self-Portrait. Create several customizations, for example, facial expressions, clothing variations, color variations…Think about character design in games, building Nintendo Mii’s, or your emoji on your phone.
  • You must create and integrate custom functions for these customizations. Think about passing values to functions for more control of customizations.
  • Use conditionals to vary expressions on the Self-Portrait, for example clicking the eyes may make their size larger, moving the mouse up-down may make the smile to a frown, clicking the portrait may change colors, several buttons to click and change appearance or actions etc.
  • For an extension, you could create HTML buttons, checkboxes, or sliders to control the customizations of your self-portrait.
  • Create a styled webpage using the basic wireframe shown below as a guide. Borders are optional. (We are keeping the layout same as last project to increase class time to use for the Javascript part.)
    • Use BULMA css classes to style your site and content within.
  • Define the vocabulary from this lesson. Use font size or style to emphasize Vocabulary Word and its definition clearly. See template shown above.
  • Answer the study questions. Use font size or style to emphasize each question and answer pair clearly.
  • Name your sketch and comment your code.
  • Use camelCase for variable, function names, or where ever appropriate.
  • Use variables for modifiable colors and other elements that the user could set at the top of the program.

Resources

  1. Video: 17 Function Basics