You're correct. That's why the second half of the expression has || divisiblyBy 400 year. For a number divisible by 400, the first half evaluates to false, then the second half evaluates to true, false || true -> true, so we get true for years divisible by 400.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Doesn't xor break for years divisible by 400?
xor true (true or true) -> xor true true -> false
Or am I reading this wrong
You're correct. That's why the second half of the expression has
|| divisiblyBy 400 year
. For a number divisible by 400, the first half evaluates to false, then the second half evaluates to true,false || true -> true
, so we gettrue
for years divisible by 400.