Search:
Forum
Beginners
Basic If Statement Question
Basic If Statement Question
Dec 8, 2013 at 10:02pm UTC
Ratham
(33)
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 UTC
S G H
(2638)
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 UTC
Topic archived. No new replies allowed.
C++
Information
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs