Skip to content

Instantly share code, notes, and snippets.

@bricejlin
Last active December 22, 2015 01:49
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/6399502 to your computer and use it in GitHub Desktop.
Save bricejlin/6399502 to your computer and use it in GitHub Desktop.
ruby learning wk 2 ex 3
def leap_year?(year)
if year % 100 == 0
year % 400 == 0 ? true : false
else
year % 4 == 0 ? true : false
end
end
def minutes_in_year(year)
if leap_year?(year)
puts "In #{year} (a leap year), there were #{365 * 24 * 60} minutes."
else
puts "In #{year}, there were #{366 * 24 * 60} minutes."
end
end
minutes_in_year(2000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment