Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 324 Bytes

Functions-in-Ruby.md

File metadata and controls

20 lines (13 loc) · 324 Bytes

You can define a function using the reserve word def they are commonly methods than return a value

def my_function
  return "something"
end

You can pass arguments that will be used within the method like this

def sum(a, b)
  return a + b
end

This method return the sum of a plus b arguments