Skip to content

Instantly share code, notes, and snippets.

@bricejlin
Last active December 22, 2015 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bricejlin/6400721 to your computer and use it in GitHub Desktop.
Save bricejlin/6400721 to your computer and use it in GitHub Desktop.
def leap_year?(year)
if year % 100 == 0
true if year % 400 == 0
else
true if year % 4 == 0
end
end
def minutes_in_year(year)
if leap_year?(year)
minutes = 365 * 24 * 60
else
minutes = 366 * 24 * 60
end
puts "In #{year}, there were #{minutes} minutes."
end
minutes_in_year(2004)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment