how to create function in ruby code example
Example 1: ruby function
def double(x)
x * 2
end
Example 2: how to create a method ruby
#start with 'def', name the method, add function, end with 'end'
def this_method_multiples_x_by_number_of_students
x * number_of_students
end
# => class_name.this_method_multiples_x_by_number_of_students
Example 3: functions in ruby
# functions in ruby
def foo()
# function body
end