December 26 - Finding Leap Years in Ruby
This Ruby coding exercise walks through how to calculate leap years in Ruby, specifically how to list out all of the leap years in the 20th century.
Guide Tasks
- Read Tutorial
- Watch Guide Video
- Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license
Already a Bottega Student? Sign In
Summary
Find and store all of the leap years in the 20th century.
Exercise Description
Given an array of all of the years in the 20th century:
years = (1900..1999).to_a
Find and store all of the leap years from the 20th century and store it in an array called leap_years
.
Real World Usage
Working with dates is common in Ruby development. This exercise will specifically let you compare building a date algorithm from scratch compared with leveraging the built in date
library provided by Ruby.