Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 836 Bytes

File metadata and controls

31 lines (23 loc) · 836 Bytes
lang EN
title Me hungry
answer ^Me not hungry.$
ok true
error No way am I hungry at 10 AM!

Okay, this is coming along wonderfully. This is simple stuff for you, but keep in mind that you didn't know any Ruby whatsoever just fifteen minutes ago!

Last step. Let's tie it all together, you know? Let's make it chime together like a very nice set of glistening chimes on the beach in the maginificent sunlight!

We'll define two methods first and then take a decision:

def hungry?(time_of_day_in_hours)
  puts "Me hungry."
  true
end

def eat_an(what)
  puts "Me eat #{what}.\n"
end

eat_an 'apple' if hungry?(14)

eat_an 'apple' if hungry?(10)

Now see if you can change the method hungry? to display "Me not hungry" and returning false when the time is less than 12.