You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/static/tutorials/arrays/index.html
+18-13Lines changed: 18 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,21 @@
1
-
<divclass="content" style="margin-top: 0px;">
2
-
<tablewidth="656" style="margin-top: 0px;">
3
-
<tr>
4
-
<td>
5
-
<h1>Arrays</h1>
6
-
<pclass="license">This tutorial is the Arrays chapter from the second edition of <em><ahref="https://mitpress.mit.edu/books/processing-0">Processing: A Programming Handbook for Visual Designers and Artists</a></em>, published by MIT Press. Copyright 2013 MIT Press. This tutorial is for Processing version 2.0+. If you see any errors or have comments, please <ahref="https://github.com/processing/processing-docs/issues?state=open">let us know</a>.</p>
7
-
8
-
<br/>
9
-
<p>
10
-
The term array refers to a structured grouping or an imposing number: “The dinner buffet offers an array of choices,” “The city of Boston faces an array of problems.” In computer programming, an array is a set of data elements stored under the same name. Arrays can be created to hold any type of data, and each element can be individually assigned and read. There can be arrays of numbers, characters, sentences, boolean values, and so on. Arrays might store vertex data for complex shapes, recent keystrokes from the keyboard, or data read from a file.
11
-
For instance, an array can store five integers (1919, 1940, 1975, 1976, 1990), the years to date that the Cincinnati Reds won the World Series, rather than defining five separate variables. Let’s call this array “dates” and store the values in sequence:
<h3style="line-height: 0.7em;"><em>Casey Reas and Ben Fry</em></h3>
10
+
11
+
12
+
<p> </p>
13
+
14
+
<pclass="txt">
15
+
The term array refers to a structured grouping or an imposing number: “The dinner buffet offers an array of choices,” “The city of Boston faces an array of problems.” In computer programming, an array is a set of data elements stored under the same name. Arrays can be created to hold any type of data, and each element can be individually assigned and read. There can be arrays of numbers, characters, sentences, boolean values, and so on. Arrays might store vertex data for complex shapes, recent keystrokes from the keyboard, or data read from a file. For instance, an array can store five integers (1919, 1940, 1975, 1976, 1990), the years to date that the Cincinnati Reds won the World Series, rather than defining five separate variables. Let’s call this array “dates” and store the values in sequence:
Code inside this block is run one time when any key is pressed
1639
+
</td>
1640
+
</tr>
1641
+
<tr>
1642
+
<tdstyle="width: 130px">
1643
+
<strong>keyReleased()</strong>
1644
+
</td>
1645
+
<tdstyle="width: 520px">
1646
+
Code inside this block is run one time when any key is released
1647
+
</td>
1648
+
</tr>
1649
+
</table>
1650
+
1651
+
<!--
1632
1652
<ul>
1633
1653
<li><strong>keyPressed()</strong> Code inside this block is run one time when any key is pressed</li>
1634
1654
<li><strong>keyReleased()</strong> Code inside this block is run one time when any key is released</li>
1635
-
</ul>
1655
+
</ul>-->
1636
1656
1637
1657
<pclass="txt">
1638
1658
Each time a key is pressed, the code inside the keyPressed() block is run once. Within this block, it’s possible to test which key has been pressed and to use this value for any purpose. If a key is held down for an extended time, the code inside the keyPressed() block might run many times in a rapid succession because most operating systems will take over and repeatedly call the keyPressed() function. The amount of time it takes to start repeating and the rate of repetitions will be different from computer to computer, depending on the keyboard preference settings. In this example, the value of the boolean variable drawT is set from false to true when the T key is pressed; this causes the lines of code to render the rectangles in draw() to start running.
0 commit comments