# URGENT! Need help for test tomorrow!

**URL:** <https://discourse.processing.org/t/urgent-need-help-for-test-tomorrow/12004>\
**Category:** Coding Questions\
**Created:** [June 12, 2019, 3:37am UTC](https://discourse.processing.org/t/urgent-need-help-for-test-tomorrow/12004 "2019-06-12T03:37:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![KZ0202](https://avatars.discourse-cdn.com/v4/letter/k/a8b319/32.png) [@KZ0202](https://discourse.processing.org/u/KZ0202)\
**Post date:** [June 12, 2019, 3:37am UTC](https://discourse.processing.org/t/urgent-need-help-for-test-tomorrow/12004/1 "2019-06-12T03:37:52Z")

</div>

I have a test tomorrow and I don’t know what is wrong with my code. I am supposed to make one ellipse and a rectangle with a circle following the mouse. The circle is on top of the ellipse but behind the rectangle. How do you make it so that when the mouse is over the rectangle, the rectangle changes color to brown and the background changes to green. I tried the code below but when I place my mouse on the rectangle, only the background changes color, and not the rectangle. Am I doing something wrong? Please help!!!

```auto
void setup() {
size(600,600);
background(26,204,243);
}
void draw() {
background(26,204,243);

if ((mouseX >= 200 && mouseX <= 400) && (mouseY >= 100 && mouseY <= 500)) {
  fill(200,200,200);
ellipse(300,100,500,200);

fill(215,23,23);
ellipse(mouseX,mouseY,20,20);

fill(10,35,222);
rect(200,100,200,400);

} else
background(53,148,30);
fill(200,200,200);
ellipse(300,100,500,200);

fill(215,23,23);
ellipse(mouseX,mouseY,20,20);

fill(50,50,50);
rect(200,100,200,400);
}

```

---

<div class="post-metadata">

**Author:** ![Tinstar](https://avatars.discourse-cdn.com/v4/letter/t/898d66/32.png) [@Tinstar](https://discourse.processing.org/u/Tinstar)\
**Post date:** [June 12, 2019, 4:27am UTC](https://discourse.processing.org/t/urgent-need-help-for-test-tomorrow/12004/2 "2019-06-12T04:27:58Z")

</div>

You have `{}`s around your `if` block, but not around your `else` block. Abstractly, your `draw()` method should look like this:

```auto
void draw() {
  if (someCondition) {
    // do something
  }
  else {
    // do something else
  }
}

```

`if` and `else` will work without brackets after, but if you don’t put brackets, they’ll only process the very first line following the `if` or `else`. Since your `background()` is the first thing declared after the `else`, that’s why only the background is changing.
