Lab 1: Checkerboard
in-class
for (var i=0; i < 10; i++) {
// use i here
}
Change the "20" and "30" values to the variable names you used in the for loops. At the end of this step, you should see a completely blue rectangle.
if (x == 10) {
// do something here
}
Helpful syntax:
% // mod operator (i.e. 10 % 2, which equals 0) && // and (which in Python is actually written "and") || // or (also just "or" in Python)
If you finished Step 3, that's great! If you have extra time, modify your if statement to create a checkerboard pattern. How can you modify the size of the squares without modifying the fillRect arguments? Experiment with different colors and patterns. Here is an example below:
You do not have to turn this lab in, but you are welcome to email me your image (take a screenshot and save as a .png file). I will demo some interesting checkerboards on Monday. Also make sure your partner and others around you are making progress. For labs, feel free to compare code and share ideas.