Last active
December 22, 2015 02:08
-
-
Save bricejlin/6400721 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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