June 2010
Beginner
210 pages
3h 45m
English
We’ve introduced new programming ideas in each chapter (variables, functions, objects) and now we’ve come to the last step—arrays! An array is a list of variables that share a common name. Arrays are useful because they make it possible to work with more variables without creating a new name for each. This makes the code shorter, easier to read, and more convenient to update.
To see what we mean, refer to Example 7-3: Move a Shape. This code works fine if we’re moving around only one shape, but what if we want to have two? We need to make a new x variable and update it within draw():

floatx1=−20;
Read now
Unlock full access