Ruby methods are similar to Functions in other programming languages.
If you have a group of statements that executes repeatedly, you can move those statements into methods. It helps to call these methods in other parts of a program.
Ruby provides the following things
- Method declaration
- Calling methods
Ruby Methods
Here is a syntax for a method in Ruby
def method-name[(arguments)]
statements
end
def
and end
are keywords in ruby.