Skip to Main Content
Getting Started with Processing
book

Getting Started with Processing

by Casey Reas, Ben Fry
June 2010
Beginner content levelBeginner
210 pages
3h 45m
English
Make: Community
Content preview from Getting Started with Processing

Appendix D. Variable Scope

The rule of variable scope is defined simply: a variable created inside a block (code enclosed within braces: { and }) exists only inside that block. This means that a variable created inside setup() can be used only within the setup() block, and likewise, a variable declared inside draw() can be used only inside the draw() block. The exception to this rule is a variable declared outside of setup() and draw(). These variables can be used in both setup() and draw() (or inside any other function that you create). Think of the area outside of setup() and draw() as an implied code block. We call these variables global variables, because they can be used anywhere within the program. We call a variable that is used only within ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Processing

Learning Processing

Daniel Shiffman
Getting Started with Processing.py

Getting Started with Processing.py

Allison Parrish, Ben Fry, Casey Reas

Publisher Resources

ISBN: 9781449379827Supplemental ContentErrata