puts only outputs. On the other hand, return only returns the return value. puts cannot be used to pass values. return has no output.
puts.rb
def greet
puts "Hello"
end
@example = greet
@example =>nil
return.rb
def greet2
return "Hello"
end
@example2 = greet2
@example =>"Hello"
Is it a miso to use properly whether or not to pass the value? I don't have enough study about the return value
Recommended Posts