【发布时间】:2021-11-26 20:57:35
【问题描述】:
您好,我正在做这个问题,但它没有通过自动化测试,很想知道我哪里出错了?非常感谢。
问题: hello 函数应该返回(而不是 puts) '早上好!' 09:00 至 12:00 之间和 '下午好!' 12:00 至 16:00 之间和 '你好!'其他时间
def hello
t = Time
if t = (0900..1200)
return 'Good morning!'
elsif t = (1201..1600)
return 'Good afternoon!'
else
return "Hello!"
end
end
hello
【问题讨论】:
标签: ruby if-statement methods time return-value