CS116 Lecture Notes - Lecture 2: Sunscreen, Ellipse

152 views5 pages

Document Summary

It has a type (which can"t change) and a current value (which can change). A declarationintroduces a new variable and optionally gives it an initial value. int a; float b = 6. 28; boolean c = b > 19; Say a variable"s name to read from it. Some are updated automatically, and are meant to be read repeatedly. Every declaration in processing has a scope: the part of the program source code in which that declaration is valid. Usually either global or bounded by the nearest enclosing {}. If in doubt, just avoid re-using the same names! By default, processing will execute statements in the order they"re given. Condition if (keypressed && key == " ") { ellipse (mousex, mousey, 20, 20); Condition while (y < height;) { line (0, y, width, y); y++; Update! for (int y = 0; y < height; y++) { line (0, y, width, y); Abstraction: think about problem solving at a higher level;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents