21 Arrays

What are arrays and in what ways can we use them?

Vocabulary

Arrays, index, element, zero-indexed

Study Questions

  1. What does it mean for an array to be zero-indexed?
  2. Name some ways to make use of arrays in a program?
  3. How can we choose random elements from an array?
  4. How can a loop be used to iterate through an array?

Activity

  • Watch Video #1 (below)
  • Create a Fortune Cookie Message Generator
  • Create an array that holds 10 fortune cookie messages. Use google search or link provided below in resources to get some messages.
  • Style your printed text! Use fonts from Google Fonts and different font-styles.
  • Style the background using a for loop and in a theme related to the words ‘fortune cookie’.
    • 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.
    • Use functions for blocks of reusable code.
    • Discuss the answers to study questions.

Resources

  1. Video: 21 Arrays
  2. Link: Funny Fortune Cookie Sayings
  3. Link: Google Fonts