# Pls help me with my homework

**URL:** <https://discourse.processing.org/t/pls-help-me-with-my-homework/27439>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [January 28, 2021, 4:16pm UTC](https://discourse.processing.org/t/pls-help-me-with-my-homework/27439 "2021-01-28T16:16:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![campervi](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@campervi](https://discourse.processing.org/u/campervi)\
**Post date:** [January 28, 2021, 4:16pm UTC](https://discourse.processing.org/t/pls-help-me-with-my-homework/27439/1 "2021-01-28T16:16:58Z")

</div>

Please help me with my homework.

No.1  
-Size 500 x 500  
-Background: White  
-Rectangle start: x = 10, y = 30  
-Rectangle size 40 horizontal and 30 vertical  
-Use width / height variables  
-Color: Make gradiation occur

 ![스크린샷 2021-01-29 오전 1.09.55](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/3/34adf191c8c1014cc099df9482083de7f079b05f.png)

I wrote so far without using the width and height variables.

```auto
void setup() {
  size(500, 500);
}

void draw(){
  background(255);
  rectMode(CORNER);
  int x = 10, y = 30;
  for (int i = 0; i < 230; i +=30){
    fill(200, 150, i);
    rect(x, y, 40, 30);
    x+=40;
    y+=30;
    rect(x, y, 40, 30);
    x+=40;
    y-=30;
  }
}

```

---

<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:** [January 28, 2021, 5:04pm UTC](https://discourse.processing.org/t/pls-help-me-with-my-homework/27439/2 "2021-01-28T17:04:10Z")

</div>

> [@campervi](#):
>
> `i < 230`

No

i\<width/2

?

Regards,

Chrisir

---

<div class="post-metadata">

**Author:** ![campervi](https://avatars.discourse-cdn.com/v4/letter/c/d07c76/32.png) [@campervi](https://discourse.processing.org/u/campervi)\
**Post date:** [January 29, 2021, 9:40am UTC](https://discourse.processing.org/t/pls-help-me-with-my-homework/27439/3 "2021-01-29T09:40:34Z")

</div>

Thanks

```auto
void setup() {
  size(500, 500);
}

void draw(){
  background(255);
  rectMode(CORNER);
  int i = 0;
  for (int y = 30; y < width; y +=100){
    i += 20;
    for (int x = 10; x < height; x +=40){
      // fill(x+i, height/x-45, 211, 150);
      fill(#0AE6F0, x-i);
      rect(x, y, 40, 30);
      x+=40;
      y+=30;
      fill(#0AE6F0, x-i);
      rect(x, y, 40, 30);
      y-=30;
    }
  }
}

```
