Exercise 1: Number of Days in a Month
Explore how to apply Ruby conditionals to determine the number of days in any given month. Understand handling leap years and use practical exercises to solidify your grasp of conditional statements in Ruby programming.
We'll cover the following...
We'll cover the following...
Problem statement
Given a month containing a number from one to 12 and a leap_year variable set to true or false, return the number of days in that month.
Examples
Input:
month = 3
leap_year = true
Output:
result = 31
Input:
month = 2
leap_year = true
Output:
result = 29