define your own method with def/end : def « Method « Ruby






define your own method with def/end


def hello
  puts "Hello, Matz!"
end

hello # => Hello, Matz!

 








Related examples in the same category

1.Use def to define a function
2.def and end define the welcome method: