# "error on void " what is wrong?

**URL:** <https://discourse.processing.org/t/error-on-void-what-is-wrong/40510>\
**Category:** Beginners\
**Created:** [January 8, 2023, 11:17am UTC](https://discourse.processing.org/t/error-on-void-what-is-wrong/40510 "2023-01-08T11:17:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Siyue](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Siyue](https://discourse.processing.org/u/Siyue)\
**Post date:** [January 8, 2023, 11:17am UTC](https://discourse.processing.org/t/error-on-void-what-is-wrong/40510/1 "2023-01-08T11:17:18Z")

</div>

hey guys. I am still on the beginner’s page and trying to figure out the OOP and the error hint keep telling me “error on void” and I have no idea where did I go wrong.

```auto
Bubble b1;
Bubble b2
  void setup() {
  size(600, 600);
  b1=new Bubble(10);
  b2=new Bubble(30);
}
void draw() {
  background(100, 20, 90);
  b1.display();
  b1.ascend();
  b1.top();
}

```

//the class bubble section as below:

```auto
class Bubble {
  float x;
  float y;
  float diameter;
   Bubble(float tempD){
    x=width/2;
    y=height;
    diameter=tempD;
  }
  void display() {
    fill(20, 20, 90);
    stroke(0);
    ellipse(x, y, diameter, diameter);
  }
  void ascend() {
    y--;
    x=x+random(-2,4);
  }
  void top(){if(y<0){y=y+hieght;}}
}

```

---

<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 8, 2023, 11:42am UTC](https://discourse.processing.org/t/error-on-void-what-is-wrong/40510/2 "2023-01-08T11:42:22Z")

</div>

> [@Siyue](#):
>
> ```auto
> Bubble b1;
> Bubble b2
> 
> ```

Missing ` ; ` here

You can tell from the wrong indent of `void setup()`

Warm regards,

Chrisir

---

<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 8, 2023, 11:50am UTC](https://discourse.processing.org/t/error-on-void-what-is-wrong/40510/3 "2023-01-08T11:50:14Z")

</div>

> [@Siyue](#):
>
> `if(y<0){y=y+hieght;}`

Consider

```auto

if(y < -diameter) {
    y = height+diameter; // reset to bottom 
}

```

- it’s height

- and to make it look better, make sure bubble has left the screen entirely and is placed under the bottom of the screen entirely

---

<div class="post-metadata">

**Author:** ![Siyue](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Siyue](https://discourse.processing.org/u/Siyue)\
**Post date:** [January 8, 2023, 1:32pm UTC](https://discourse.processing.org/t/error-on-void-what-is-wrong/40510/4 "2023-01-08T13:32:34Z")

</div>

aha ! and SMH Siyue. I always made this type of mistake. Always. Unavoidable.  
thank you Chris.  
so there is an extension question: how do you figure out where is the problem when you saw this type of error hint. Since I am a careless person, I did read through it and I could not find the problem. is there any tricks or I just have to check it very carefully

---

<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 8, 2023, 2:52pm UTC](https://discourse.processing.org/t/error-on-void-what-is-wrong/40510/5 "2023-01-08T14:52:51Z")

</div>

> [@Siyue](#):
>
> how do you figure out where is the problem when you saw this type of error hint.

It’s a broad question.

- here it was the wrong indent of the line void setup().

- It was too far right.

- In theory, when you write a line, read it and check it, if it’s correct. Directly after you’ve written it.

- next step is to comment out chunks of code. When it runs, the last chunk contains the error.

> [@Siyue](#):
>
> I just have to check it very carefully

that’s true also.
