# String art in Processing. What I've got so far. SOLVED

**URL:** <https://discourse.processing.org/t/string-art-in-processing-what-ive-got-so-far-solved/43886>\
**Category:** Coding Questions\
**Created:** [February 11, 2024, 5:41pm UTC](https://discourse.processing.org/t/string-art-in-processing-what-ive-got-so-far-solved/43886 "2024-02-11T17:41:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matty27](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@Matty27](https://discourse.processing.org/u/Matty27)\
**Post date:** [February 11, 2024, 5:41pm UTC](https://discourse.processing.org/t/string-art-in-processing-what-ive-got-so-far-solved/43886/1 "2024-02-11T17:41:16Z")

</div>

Good afternoon all.  
I’m trying to use processing to create some “string art”, which is overlapping lines that form curves. The code I’ve got is below. I’ve tried to make it so that I don’t have hard-coded values, meaning I can change just one or two little things and it makes a different image.

The problem I have is that the final line doesn’t get drawn, and every tweak I’ve tried makes things worse.

I’ve made comments in the code pasted below, so it should be clear what I’m doing. If my explanation isn’t clear, running the code generates the image, and you can see where there is a missing final line in the resulting image.

Could somebody please help me out here?

Thanks for reading

```auto
size(600, 600);

background(255);
int gap = 15;
int heightMinusGap = height - gap;

float lineBeginX = gap; // line origin x position
float lineBeginY = gap; // line origin y position
float lineEndX = gap; // line end x position
float lineEndY = heightMinusGap; // line end y position

// This loop draws a line beggining at the line origin x, y and 
// ending at the line end x, y. Once the line is drawn, it adds "gap"
// to both the line origin y position, leaving the x position 
// the same as the setup figures, and the line end x position
// leaving the line end the same as at the start. When it gets to 
// the canvas height minus the gap figure, the loop exits.

while (lineBeginY < heightMinusGap){
   line(lineBeginX, lineBeginY, lineEndX, lineEndY);
lineBeginY = lineBeginY + gap;
lineEndX = lineEndX +gap;
}

```

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [February 11, 2024, 5:51pm UTC](https://discourse.processing.org/t/string-art-in-processing-what-ive-got-so-far-solved/43886/2 "2024-02-11T17:51:01Z")

</div>

Hello @Matty27,

Try:  
`<=`

Reference:

> **[\<= (less than or equal to) / Reference](https://processing.org/reference/lessthanorequalto.html)**
>
> Tests if the value on the left is less than the value on the right or if the values are equivalent.

`:)`

---

<div class="post-metadata">

**Author:** ![Matty27](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@Matty27](https://discourse.processing.org/u/Matty27)\
**Post date:** [February 11, 2024, 5:54pm UTC](https://discourse.processing.org/t/string-art-in-processing-what-ive-got-so-far-solved/43886/3 "2024-02-11T17:54:14Z")

</div>

That worked perfectly.  
Thank you very much
