Basic If Statement Question

Dec 8, 2013 at 10:02pm
Write your question here.
I'm looking at some code and I got to an if statement
1
2
3
if(x%y) || (y == 2){

}


What in the heck is the x%y? I get that it's modulus/remainder but in this content does it mean if the remainder is 0 to count it as true?
Dec 8, 2013 at 10:05pm
No.
if(any expression here)
will be true when the expression evaluates to NOT 0.
Usually a boolean true, but for the modulo operator, as for any integer number, it will be true when the result is NOT 0.
Last edited on Dec 8, 2013 at 10:06pm
Topic archived. No new replies allowed.