You call a method just by saying its name. If a method takes arguments, you must define a function. You put the argument in parenthesis when you call it.
ex: def square(n)
splat arguments. Splat arguments are arguments preceded by an asterisk *. This tells the program that the method can receive one or more arguments.
Blocks are like nameless methods
Blocks can be defined with either the keywords "do, end, or curly braces {}"
Sorting:
- Most sorting algorithms assume we are sorting an array of items, which involves comparing any two items in the array and deciding which should come first.
Top comments (0)