"if" structure with more than one variable

Hello, I have to make a code which evaluates more than one variable with an if

Let me explain, I have 4 variables with the function Serial.parseInt();

And I need to send a response only if these 4 variables are different from 0

I just don't know of any way to have an "if" evaluate more than one variable, or any other way to fix it without ending up stuck in undecipherable errors.

If anyone knows how to solve this I would appreciate your collaboration.

Thank you

investigate
if (A&&B&&C&&D)
where A,B,C,D can each be (n!=0), which evaluates to true if n is anything but 0.
Read about Boolean Operators here:

1 Like

If your 4 variables are called a, b, c and d, something along the lines of

if( a != 0 && b != 0 && c != 0 && d != 0 ) {
   ...
}
1 Like

Do you want to send a response only if all four of your variables are different from zero?
See:

Or, is it enough for just one of the four variables to be different from zero?
See:

1 Like

All to be different to 0

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