Skip to content

Instantly share code, notes, and snippets.

def leap_year?(year)
if year % 4 == 0
puts true
elsif year % 100 == 0
puts false
elsif year % 100 == 0 && year % 400 == 0
puts true
elsif year % 4 == 0 && year % 100 == 0 && !(year % 400 == 0)
puts false
def welcome(string)
if (string.match("CA"))
puts "Welcome to California"
else
puts "You should move to California"
end
end
def welcome(string)
if (string =~ /CA(.*)/ )
puts "Welcome to California"
else
puts "You should move to California"
end
end
def leap_year?(year)
if (year % 4 == 0)
return true
elsif (!(year % 400 == 0) and (year % 100 == 0 and year % 4 == 0))
return false
elsif ((year % 100 == 0 and year % 400 == 0) and !(year % 4 == 0))
return true
end
end