I am not sure why i am getting "unexpected token: void" any help with this would be greatly appreaciated

I believe I have done this code correctly bet I am new to processing so it might be wrong the code is here if anyone can help. I am trying to make a dog face and the background changes to a random colour when I click.

color bColor = color(255, 255, 255);

void setup() {

size(500,500);


fill(15,15,15);
rect(110,80,60,20);// first eyebrow
ellipse(140,120,20,20);//eye
rect(280,80,60,20);// second eyebrow
ellipse(310,120,20,20);//eye
triangle(270,155,230,245,180,155);//nose

{ noFill();
 arc(200, 230, 70, 50, 0, PI); // mouth
 arc(200, 230, 70, 50, 0, PI); // mouth
 arc(200, 230, 70, 50, 0, PI); // mouth
 
 arc(260, 230, 70, 50, 0, PI); // mouth
 arc(260, 230, 70, 50, 0, PI); // mouth
 arc(260, 230, 70, 50, 0, PI); // mouth
}
fill(24,24,24);
 rect(157,280,150,30);  // bone shape 
ellipse(160,280,40,40); // circles to complete bone shape
ellipse(160,310,40,40); // circles to complete bone shape
ellipse(310,280,40,40); // circles to complete bone shape
ellipse(310,310,40,40); // circles to complete bone shape
fill(82,36,224);
textSize(32);
text("CREEKER PETS",140,400); 
fill(34,6,121);
line(140,405,360,405); // underlining words 
}

{
void draw()background(bColor);
}
void mousePressed() {
  bColor= color(random(255), random(255), random (255));
1 Like

Seem suspicious, Rewrite this block of code

1 Like

Don’t do this:

{
   void aFunction() aCommand();
}

instead do this:

void aFunction() {
  aCommand();
  aCommand();
}

Also, get rid of the { } here:

{ noFill();
// ...
}
fill(24,24,24);

You can add { } almost anywhere, but they probably aren’t doing what you think they are. Only use them like this:

https://processing.org/reference/curlybraces.html