The usage of modulo: How can I correctly implement it?

a practical app for use
modulo and floor to make a GRID
in a one line FOR loop

// https://discourse.processing.org/t/scalable-grid-with-rectangles/7256
int x = 10, y = x, w = 20, h = w;
int grid = 24, many = grid*grid;

void setup() {
  size(500, 500);
  stroke(0, 0, 200);
  fill(0,200,0);
}

void draw() {
  background(200,200,0);
  for (int i = 0; i < many; i++)  rect(x+(i%grid)*w, y+(floor(i/grid))*h, w, h); 
}