Most years have 52 weeks, some have 53, according to ISO8601.



Task

Write a function which determines if a given year is long (53 weeks) or not, and demonstrate it.




 
require 'date'
 
def long_year?(year = Date.today.year)
  Date.new(year, 12, 28).cweek == 53
end
 
(2020..2030).each{|year| puts "#{year} is long? #{ long_year?(year) }." } 
 