Presentation is loading. Please wait.

Presentation is loading. Please wait.

Code Grammar. Syntax A set of rules that defines the combination of symbols and expressions.

Similar presentations


Presentation on theme: "Code Grammar. Syntax A set of rules that defines the combination of symbols and expressions."— Presentation transcript:

1 Code Grammar

2 Syntax A set of rules that defines the combination of symbols and expressions

3 Curly Braces Always work in balanced pairs (an open and closed pair) Used to structure code blocks

4 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?

5 Vocabulary

6 Comments Ignored by the computer Helps us write notes Helps remember what that part of the program does

7 Functions Allow us to execute certain actions like draw shapes, set colors Usually lowercase followed by parentheses

8 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

9 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

10 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

11 Operators Symbols used to write mathematical expressions + (Addition) - (Subtraction) * (Multiplication) / (Division)

12 Relational Operators > (greater than) >= (greater than and equal to) < (less than) <= (less than and equal to) == (equal to) != (not equal to)

13

14 References Processing: A programming Handbook for Visual Designers - Casey Reas, Ben Fry Processing: Creative Coding and Computational Art - Ira Greenberg

15 Op Open CodeLabs Every Wednesday, 6:00pm - 8:00pm 10th Floor Lab, Building L


Download ppt "Code Grammar. Syntax A set of rules that defines the combination of symbols and expressions."

Similar presentations


Ads by Google