Histogram Flashcards
What is a ‘Histogram’?
A visual representation of data is called a histogram.
What is a method?
A method is a reusable section of code written to perform a specific task in a program.
Why do we use methods?
- Easy to fix bugs
2. We use separation of concerns
How do you define a method?
You use the def syntax along with end
What is the structure of a method?
def method_name
the_method_body
end
What is calling a method/function?
We call a method or a function when we want to use it.
What is a NameError?
You get a NameError when your program can’t find the method.
What is an argument?
The argument is the piece of code you actually put between the method’s parentheses when you call it
What is a parameter?
parameter is the name you put between the method’s parentheses when you define it.
What are splat arguments?
Splat arguments are arguments preceded by a *, which tells the program that the method can receive one or more arguments.
What is return?
When we want to get back a a value from the method instead of printing it to the console.
What are blocks?
Blocks are nameless methods.
Blocks can be defined with either the keywords do and end or with curly braces ( { } ).
They are only called once
Why do we use code blocks?
Because we want to use abstraction, which is basically making the code simpler.
What is a combined comparison operator?
The combined comparison operator is used to compare two ruby objects