I\'m new to programming so I have been working through the exercises at CodingBat.com. In the Recursion-2 section, there is a problem I wasn\'t able to solve (recursively) so I
return a || b;
does not mean:
return a || return b;
It actually means:
return (a || b);
It will evaluate a || b, and then return the result of that:
So if a or b is true (either one, or both, are true), it will return true. It will only be false if a and b are both false.
The point is: it evaluates the boolean expression first, then returns the value.
Edit: You can look at this test code for examples on how it works.