How to fill color in chess board

How to fill color in chess board

First use a double (nested) for loop to make the grid

Check the % sign in the reference

You can distinguish between even and uneven numbers, see below

Distinguish between even and uneven row numbers and then for each of them between even and uneven columns using ifs and else again.

Then inside those use fill

if(rowNum%2 == 0) {

  ....? fill 
    else fill

}else {

...?

}

There are shorter ways

But as a beginner it’s good

Also note there are 4 fill commands but only 2 colors so 2 fills are the same

Chrisir

1 Like

Thank you…
Trying …

2 Likes