Code Grammar
Syntax A set of rules that defines the combination of symbols and expressions
Curly Braces Always work in balanced pairs (an open and closed pair) Used to structure code blocks
Naming Convention Legal names can only contain letters, underscores, numbers, and the dollar sign The initial character must be a letter, underscore, or dollar sign - not a number The names you define are called identifiers Legal identifiers Illegal identifiers. Why?
Vocabulary
Comments Ignored by the computer Helps us write notes Helps remember what that part of the program does
Functions Allow us to execute certain actions like draw shapes, set colors Usually lowercase followed by parentheses
Expressions, Statements An expression o like a phrase o Often a combination of operators A statement o A set of expressions o Like a sentence o Ends with the statement terminator
Data types Processing can store and manipulate different kinds of data including numbers, letters, words, colors, etc The computer stores each in a different way so it needs to know which kind of data it is in order to manage it int integer data float floating-point numbers that have a decimal point String Words and sentences boolean True or false
Variables A container for storing data Allows a data element to be reused Every variable had a name, value and data type A variable must be declared before it is used
Operators Symbols used to write mathematical expressions + (Addition) - (Subtraction) * (Multiplication) / (Division)
Relational Operators > (greater than) >= (greater than and equal to) < (less than) <= (less than and equal to) == (equal to) != (not equal to)
References Processing: A programming Handbook for Visual Designers - Casey Reas, Ben Fry Processing: Creative Coding and Computational Art - Ira Greenberg
Op Open CodeLabs Every Wednesday, 6:00pm - 8:00pm 10th Floor Lab, Building L