xxxxxxxxxx
23
/* My current sketch shows two separate for loops, each drawing a row / column of rectangles. First, help me reconfigure the two for loops so that they will draw a grid on the canvas. Second, use the remainder operator (modulo) to create a blue checkerboard pattern like the example image. */
function setup() {
createCanvas(400, 400);
// noStroke();
}
function draw() {
background(220);
for (let i = 0; i < 20; i++) {
for(let j = 0; j<20, i++){
if(i%2 == 1 && j%2 == 1 || i%2 == 0 && j%2 = 0){
fill(0, 0, 255);
} else {
fill(255);
}
rect(i * 20, 0, 20, 20);
}
}
}