0

What is the work of OR operator

17th Oct 2016, 7:28 AM
kevink mahadeo
kevink mahadeo - avatar
2 odpowiedzi
+ 4
The or operator is ||. Given two booleans a and b, (a || b) is true if and only if at least one of them is true. Example: /*checks if the point at coordinates (x, y) is on the vertical or horizontal axis.*/ bool onAxis(int x, int y) { if ((x == 0)||(y == 0)) { return true; } return false; }
17th Oct 2016, 8:33 AM
Zen
Zen - avatar
0
Thanks you
17th Oct 2016, 8:24 AM
kevink mahadeo
kevink mahadeo - avatar