From: Colin Bartlett Date: 2009-12-24T06:42:46+09:00 Subject: Date.gregorian_leap? code from date.rb # Is a year a leap year in the Gregorian calendar? # All years divisible by 4 are leap years in the Gregorian calendar, # except for years divisible by 100 and not by 400. def self.gregorian_leap? (y) y % 4 == 0 && y % 100 != 0 || y % 400 == 0 end Because of the precedence of && and || this is presumably parsed as ( y % 4 == 0 && y % 100 != 0 ) || y % 400 == 0 and I'm trying to think of reasons why it is coded as it is instead of, say: y % 4 == 0 && ( y % 100 != 0 || y % 400 == 0 ) Any suggestions?