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 % 4 == 0 | |
puts "I am divisible by 4!" | |
true | |
elsif year % 100 == 0 | |
puts "I am divisible by 100!" | |
false | |
elsif year % 100 == 0 && year % 400 == 0 | |
puts "I am divisible by 100 and 400!" | |
true |
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 valid_triangle?(a, b, c) | |
if ((a == 0 or b == 0 or c == 0) or (a == nil or b == nil or c == nil)) | |
return false | |
end | |
if a + b > c | |
puts "case 1" | |
return true |