# Help with coding syntax errors

**URL:** <https://discourse.processing.org/t/help-with-coding-syntax-errors/41110>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [March 1, 2023, 9:25pm UTC](https://discourse.processing.org/t/help-with-coding-syntax-errors/41110 "2023-03-01T21:25:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielsj14](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@danielsj14](https://discourse.processing.org/u/danielsj14)\
**Post date:** [March 1, 2023, 9:25pm UTC](https://discourse.processing.org/t/help-with-coding-syntax-errors/41110/1 "2023-03-01T21:25:29Z")

</div>

I’m trying to code a moving grid pattern and I keep getting an error message when I try to run my code, but I can’t figure out why. This is what my code looks like:

```
float x = 0;
float y = 0;
float spacing = 50;

//One array for your X sizes.
int[] linesArrX = {50, 200, 350, 500, 650};

//One array for your Y sizes.
int[] linesArrY = {50, 200, 350, 500, 650};

//One array for your Weights.
int[] linesWeight = {30, 25, 20, 15, 10};
////////////////////////////////////////////////////////////////////////////////////////
void setup() {
  size(1450, 750);
}
////////////////////////////////////////////////////////////////////////////////////////
void draw() {
  background(206, 117, 190);
  //lines move across screen giving the illusion of zooming in
  spacing = spacing + random(3);
  //(value 1 = positioning, value 2 = stroke weight)

  //Both of these arrays are the same length (LinesXArr.length = linesWEight.length). So let's iterate through linesXArr.
  //Start at array position 0 and go to the end of the array (linesArrX.length)
  for (int i = 0; i < linesArrX.length; i++) {
    linesX(linesArrX[i], linesWeight[i]);
  }

  //Both of these arrays are the same length (LinesYArr.length = linesWEight.length). So let's iterate through linesYArr.
  //Start at array position 0 and go to the end of the array (linesArrY.length)
  for (int i = 0; i < linesArrY.length; i++) {
    linesY(linesArrY[i], linesWeight[i]);
  }
}
////////////////////////////////////////////////////////////////////////////////////////

//x-axis Lines
void linesX(int _x, int w) {
  strokeWeight(w);
  x = _x;
  while (x < width) {
    line(x, 0, x, height);
    x = x + spacing;
  }
}

//y-axis Lines
void linesY(int _y, int w) {
  strokeWeight(w);
  y = _y;
  while (y < height) {
    line(0, y, width, y);
    y = y + spacing;
  }
}

```

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [March 1, 2023, 10:02pm UTC](https://discourse.processing.org/t/help-with-coding-syntax-errors/41110/2 "2023-03-01T22:02:37Z")

</div>

I haven’t made any real changes, code runs here

```auto

float x = 0;
float y = 0;

float spacing = 50;

// One array for your X sizes.
int[] linesArrX = {50, 200, 350, 500, 650};

// One array for your Y sizes.
int[] linesArrY = {50, 200, 350, 500, 650};

// One array for your Weights.
int[] linesWeight = {30, 25, 20, 15, 10};

//-------------------------------------------------------------------------------------------

void setup() {
  size(1450, 750);
}

//-------------------------------------------------------------------------------------------

void draw() {
  background(206, 117, 190);
  //lines move across screen giving the illusion of zooming in
  spacing = spacing + random(3);
  //(value 1 = positioning, value 2 = stroke weight)

  //Both of these arrays are the same length (LinesXArr.length = linesWEight.length). So let's iterate through linesXArr.
  //Start at array position 0 and go to the end of the array (linesArrX.length)
  for (int i = 0; i < linesArrX.length; i++) {
    linesX(linesArrX[i], linesWeight[i]);
  }

  //Both of these arrays are the same length (LinesYArr.length = linesWEight.length). So let's iterate through linesYArr.
  //Start at array position 0 and go to the end of the array (linesArrY.length)
  for (int i = 0; i < linesArrY.length; i++) {
    linesY(linesArrY[i], linesWeight[i]);
  }
  //
}

//-------------------------------------------------------------------------------------------

//x-axis Lines
void linesX(int _x, int w) {
  strokeWeight(w);
  x = _x;
  while (x < width) {
    line(x, 0, x, height);
    x = x + spacing;
  }
}

//y-axis Lines
void linesY(int _y, int w) {
  strokeWeight(w);
  y = _y;
  while (y < height) {
    line(0, y, width, y);
    y = y + spacing;
  }
}
//

```

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [March 1, 2023, 10:06pm UTC](https://discourse.processing.org/t/help-with-coding-syntax-errors/41110/3 "2023-03-01T22:06:14Z")

</div>

Hi

what is your error massage ?

Your sketch running normal

 ![Screenshot_2023-03-02-01-02-18-284](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/8/6/860abdb269a24f31021694d3397dbf2b6fec6d90.jpeg)
