Humidity range IF statement

Help, one line of my code is doing my head in, im trying to make an IF statement for humidity between 60 and 65.

my code is;

if ((int)humidity < 65) && ((int)humidity > 60)  

I keep getting this error, I m sure ive fixed this before

if ((int)humidity < 65); && ((int)humidity > 60); { // Ok Humidity - Do nothing
^

exit status 1

Compilation error: expected identifier before '(' token

Try

if (((int)humidity < 65) && ((int)humidity > 60))

But, why the (int) ? Doesn't seem necessary.

Hey Paul,

I have no idea, im making this up as i go along. Half the code came from other people

Error, ok...

So did my suggestion fix the error?

Wait a minute...

if ((int)humidity < 65) && ((int)humidity > 60)

Where did that ; come from?

yes it did thanks, Im not sure where that came from lol
ive been awake for 18 hours now :expressionless:

Yeah... The one thing that fixes more coding errors than anything else is... 8 hours of good sleep.

if (humidity < 65 && humidity > 60)

should also work and is much simpler.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.