Cant seem to get functions right :(

It keeps saying there’s a syntax error on the ‘void house’ line ???
I’ve tried swapping the order, adding and taking away floats , putting in comers, spaces, semi colons, brackets inside other brackets XD

I’ve looked at the flower example and read through the tutorial but cant find what I’m doing wrong?

Am I not defining the function correctly?

void draw() {
house(width/2, width/2, 30, 20);
}

void house(float x, float y float wide, float tall) {
fill(200, 200, 0);
rect(x, y, wide, tall);
}

You’re missing a comma after “float y”. It should be:

void draw() {
  house(width/2, width/2, 30, 20);
}

void house(float x, float y, float wide, float tall) {
  fill(200, 200, 0);
  rect(x, y, wide, tall);
}
2 Likes

thank you so much for your help
I’m glad it is just syntax

I was starting to think I just didn’t understand how functions worked :confused:

:heart:

1 Like

You’re welcome :wink:

1 Like