Draw rows of squares pattern

Thank you! I don’t know what the you mean by formatting it differently, but I changed my code to this:

int X_coordinate = 1;
int Y_coordinate = 1;

void changeX() {

  X_coordinate= X_coordinate + 30;
}

void changeY() {
  Y_coordinate = Y_coordinate + 30;
}

void setup () {
  size(1000, 600);
  background(255, 255, 255);
}

void draw() {
  int numberOfRows=6;
  drawPattern(numberOfRows);
  noLoop();
}
void drawPattern(int numberOfRows) {
  for (int i = 0; i<numberOfRows; i++) {
    for (int j= 0; j<i; j++) {
      for (int k =0; k<4; k++) {
        rect (X_coordinate, Y_coordinate, 20, 20);
      }
      changeX();
    }

    changeY();
    changeX();
    {
    }
  }
}

and it is producing what I have attached. I dont know what I need to do to make my squares go back to the starting place.