3.Functions and CS Hero Posters
Lesson
Functions Defined - Code.org Video with Chris Bosh
Locate two function definitions (preload & setup)
Try moving the loadImage() function from preload to setup and back again
hero = loadImage('2cynthia.png');
Show existing images located under Sketch Files
Replace 2cynthia.png with an image from Sketch Files
Exploration
What are the parts of the of the Preload & Setup Starter Project?
What do the different parts do?
Record your observations here (make a copy).
Challenge
Make your own CS Hero Poster. Copy this starter project.
Fill in the hero's job using the about() function.
Add a fun hashtag.
Add a new hero image, and update the other info.
Adjust the colors.
Be inspired!
Challenge
For each challenge, students complete a self-assessment rubric.
Let's be picky about vocabulary!
Argument - an input to a function. Example background(220). The number 220 is the argument.
Parameters - what the arguments actually mean. Example: function = background(color), where the argument = 220. But what does 220 mean? The color 220 is gray. That's the parameter.
Coordinate Plane - a two-dimensional surface created by the intersection of two lines, the x-axis and the y-axis.
Function - a set of statements that perform a task in a computer program, and may include parameters.
Defining a Function - explaining what a function should do, including its name and parameters. ex: function cake(size, col){//some stuff}
Calling a Function - running a function by calling its name and any arguments it needs. ex: cake(20, 'green');