The Ruby language makes it easy to create functions.
Your function can compute values and store them in local variables that are specific to the function. Those values can then be returned with the return statement.
var = ”Hello, ” + name
The return statement also can be shortened for very simple functions into a single line
return “Hello, ” + name
You can simplify the function further. The last expression that is evaluated is automatically returned by the method. For example:
“Hello, ” + name
This would return the same value as the prior functions.
To call a function
function param1, param2