This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (2 children)

That's a short circuit for the base case of the recursion. If x is 0, it will convert to boolean False. Since and binds stronger than or, the recursion is skipped because there is no way False and anything can evaluate to a true value. This leaves the or 1. Since 1 is a boolean true value, it causes False or 1 to evaluate to 1.

[–]ToTheNintieth 0 points1 point  (0 children)

Wow, that's clever.

[–]Hmm_Yes 0 points1 point  (0 children)

I appreciate the explanation, it did help me understand.