1 project
1 article
3 challenges
5 talkthroughs
Make your code more re-usable by grouping it into functions, and then make those functions accept parameters and return values.


Pamela explains how you can write your own custom functions to group your code and make it more reusable.

Function Parameters

Pamela shows how you can pass parameters into custom functions, so that they can behave differently each time you call them.

Function Return Values

Pamela explains how to return values from functions, especially useful in doing calculations.

Local and Global Variables

Pamela explains the difference between "local" and "global" variables, a tricky concept in programming.

Special ProcessingJS functions

Pamela explains the special predefined ProcessingJS functions that we use for drawing and interaction, like `draw()` and `mouseMoved()`.

Project: Fish Tank

This program draws a single fish. Poor lonely fish! For this project, you'll use functions to accompany him with more fish of all different shapes and colors. Create a custom function (like drawFish) that draws a fish at a given x and y ...