FANDOM


The Intro to Variables tutorial introduces the ideas of incorporating variables in the Intro to JS: Drawing & Animation programming method.

Intro to Variables Edit

In this tutorial [1], the user learns how variables can "hold on to" a value, such as a parameter or color, until used later again in the script. For example, var eyeSize (as shown in the screenshot) can be defined, and then have a value assigned to it, such as var eyeSize = 3. Winston's eyeSize is actually the example in this coding talk through.

The syntax to defining variables is:

var x = value;

A value can be assigned to any given previously stated variable by defining it on the right side of the equal sign. The user can, for example, assign a color or (pixel) value to a variable.

Example:

Variables

Jessica explains how to define and use variables.

var eyeSize = 33;

or,

var eyeColor = color(0, 0, 0); (rgb value)


External SourcesEdit

  1. https://www.khanacademy.org/computing/computer-programming/programming/variables/p/intro-to-variables
☀ All Khan Academy content is available for free at: www.khanacademy.org

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.