return
和仅放置一个变量(如以下内容)有什么区别:
没有回报
def write_code(number_of_errors)
if number_of_errors > 1
mood = "Ask me later"
else
mood = "No Problem"
end
mood
end
返回
def write_code(number_of_errors)
if number_of_errors > 1
mood = "Ask me later"
else
mood = puts "No Problem"
end
return mood
end