What is the difference between return and just putting a variable such as the following:
def write_code(number_of_errors)
Using "return" is unnecessary if it is the last line to be executed in the method, since Ruby automatically returns the last evaluated expression.
You don't even need that final "mood", nor do you need those assignments in the IF statement.
def write_code(number_of_errors)
if number_of_errors > 1
"ERROR"
else
"No Problem"
end
end
puts write_code(10)
Output:
ERROR