if statment

why is this if not executing

if((s1done == 0) && (s2done == 0) && (s3done == 0) && (s4done ==0)) donemove =1;

Because it is not a complete sketch.

Works fine on my system

byte s1done, s2done, s3done, s4done, donemove; s1done = 0; s2done = 0; s3done = 0; s4done = 0; donemove = 0; if((s1done == 0) && (s2done == 0) && (s3done == 0) && (s4done ==0)) donemove =1;

prints 1

why is this if not executing

What makes you think that it is not executing ? Have you tried printing the variables that are being tested ? Are their values what you would expect ?

Works fine on my system

byte s1done, s2done, s3done, s4done, donemove; s1done = 0; s2done = 0; s3done = 0; s4done = 0; donemove = 0; if((s1done == 0) && (s2done == 0) && (s3done == 0) && (s4done ==0)) donemove =1;

prints 1

Also an incomplete sketch, because it doesn't have a print.

I left the print out as I didn't want to reveal proprietary macros that save me from typing so much. Also, if it was a complete sketch, I would be chastised for not posting it properly with code blocks, etc.

In such a litigious society as we have devolved into, one must tread carefully along the perimeter.

If, however, I were to break it up....

prtI(donemove);lf();

Okay, that's the print statement. MY lawyers are waiting for your call.

Cheers.

The point I was trying to make to the OP was that such an incomplete snippet cannot possibly provide enough information to answer their questions.
And then you went an compounded the ignorance.

Well done.

My apologies. By not posting it as code I believed there to be a tacit understanding that it would in fact not be executable but listed as reference only.

Compound condition is evaluated from “left to right “and in case of “AND” stops when the last codition evaluates to false. No need to further evaluate the rest. You need to verify that before occusing the machine, it only does what is instructed to do.

Are you comparing floating point variables somewhere?