Can you help -- mouse over thing gives error Unexpected identifier

Can you help find and fix the Unexpected identifier error …

int thingX = 10; int thingY = 20;
int thingW = 30; int thingH = 40;

void setup() {
// noStroke();
} // end setup

void draw() {
// mouse over ( thing )
( mouseX > ( thingX )
&& mouseX < ( thingX ) + thingW
&& mouseY > thingY )
&& mouseY < ( thingY ) + thingH ) ?
fill( 0,255,0 ) : fill( 255,0,0 )
rect( thingX,thingY, thingW,thingH );
} // end draw

I’m sure you will be getting a response from someone telling you to format your code, so I would first drop that little note :smiley:

Your code seems to be quite incomplete, where is your if statement? I assume that is what you want to do:

 if ( mouseX >  thingX  && mouseX < ( thingX  + thingW ) && mouseY > thingY  && mouseY < ( thingY  + thingH)  ) 
  {
    fill( 0,255,0 ); 
  }
 else
   {
  fill( 255,0,0 );  
   }

rect( thingX, thingY, thingW,thingH );

Yeah, I think I can see what is you were trying to do? Kind of looked like those enhanced conditional if’s from C++ :joy:

Anyways, hopefully that makes sense. You were close but just missing the if statement, and you had the “:” which I’m sure gave the Unexpected Identifier error.

EnhancedLoop7