def greet(name:, message:)
puts "#{message}, #{name}!"
end
greet(name: "Alice", message: "Hello")
def greet(name:, message:)
: Defines a method named greet
with two required named parameters, name
and message
.puts "#{message}, #{name}!"
: Prints a message to the console using the provided message
and name
parameters.greet(name: "Alice", message: "Hello")
: Calls the greet
method with specific arguments assigned to the named parameters name
and message
. In this case, it will print "Hello, Alice!" to the console.