Ruby methods are similar to Functions in other programming languages.

If you have group of statemetns that executes repeately, you can move those statements into methods. It helps to call these m ethods in other parts of a program.

Ruby provides following things

  • Method declaration
  • Calling methods

Ruby Methods

Here is an syntax for method in Ruby

def method-name[(arguments)]
 statementts
end

def and end are keywords in ruby