# Basic white triangle grid homework pls help

**URL:** https://discourse.processing.org/t/basic-white-triangle-grid-homework-pls-help/34178
**Category:** Coding Questions
**Tags:** homework
**Created:** [December 18, 2021, 9:06am UTC](https://discourse.processing.org/t/basic-white-triangle-grid-homework-pls-help/34178 "2021-12-18T09:06:59Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![myhatzulu](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@myhatzulu](https://discourse.processing.org/u/myhatzulu)
#### Post date: [December 18, 2021, 9:06am UTC](https://discourse.processing.org/t/basic-white-triangle-grid-homework-pls-help/34178/1 "2021-12-18T09:06:59Z")

</div>

could anyone sort me out with this  
I’m trying to make a grid of upside down white triangles exactly like

[[Album] imgur.com ![](https://i.imgur.com/pl9Hpj2.jpeg?fb "imgur.com") ](https://imgur.com/a/gatU3pF)

with nested loops  
but so far I’ve only gotten

[[Album] imgur.com ![](https://i.imgur.com/eRwDlDb.jpeg?fb "imgur.com") ](https://imgur.com/a/YdXjYnI)

that has misaligned non grid triangles  
I’ve no idea what to change in the variables now, any help would be seriously appreciated

my current code

void setup() {  
size(420, 420);  
background(0, 255, 0);  
noStroke();  
}

void draw() {  
for (int x = 0; x \<= 420; x += width/6) {  
for (int y = 0; y \<= 420; y += height/6)

```
triangle(x, y, x + 70, y, x += 35, y + 70 );

```

}  
}

thank you

---

<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: [December 18, 2021, 11:14am UTC](https://discourse.processing.org/t/basic-white-triangle-grid-homework-pls-help/34178/2 "2021-12-18T11:14:54Z")

</div>

Hello,

There are resources (tutorials, references, examples) here:

> **[Welcome to Processing!](https://processing.org/)**
>
> Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts. Since 2001, Processing has promoted software literacy within the visual arts…

`:)`

---

<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: [December 18, 2021, 1:11pm UTC](https://discourse.processing.org/t/basic-white-triangle-grid-homework-pls-help/34178/3 "2021-12-18T13:11:32Z")

</div>

> [@myhatzulu](#):
>
> `triangle(x, y, x + 70, y, x += 35, y + 70 );`

it is unnecessary (and evil) to add something to the x variable.

```auto
x += 35

```

You change the variable of the for-loop. Or was it a typo?  
Don’t do this.

**Example**

Example which is not correct but should get you started

```auto

void setup() {
  size(420, 420);
  background(0, 255, 0);
  noStroke();
}

void draw() {
  for (int x = 0; x <= 420; x += width/6) {
    for (int y = 0; y <= 420; y += height/6) {
      triangle(x, y, 
        x - 35, y+70, 
        x+35, y+70);
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![myhatzulu](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@myhatzulu](https://discourse.processing.org/u/myhatzulu)
#### Post date: [December 22, 2021, 5:57am UTC](https://discourse.processing.org/t/basic-white-triangle-grid-homework-pls-help/34178/4 "2021-12-22T05:57:30Z")

</div>

THANK YOU SO MUCH finally got it to work
