Methods

def greet(name)
return “Hello, #{name}!”
end

puts greet(“Ayesha”)
def starts a method, end closes it.

return gives back a value.
Output:


Hello, Ayesha!

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *