Hard questions Flashcards
Is there an equivalent of “continue” in Ruby?
The Ruby next statement is used to skip loop’s next iteration. Once the next statement is executed, no further iteration will be performed.
The next statement in Ruby is equivalent to continue statement in other languages.
What is the difference between calling super and calling super()?
super - sends all arguments
super() - no arguments
What is the use of eigenclass?
The eigenclass is an unnamed instance of the class Class attached to an object and which instance methods are used as singleton methods of the defined object.
What is the difference between redo and retry?
To repeat the whole loop iteration from the start the retry statement is used. retry always used inside the loop.
Redo statement is used to repeat the current iteration of the loop.
What is the difference between #remove_method and #undef_method?
#undef_method( ) removes all methods, including the inherited ones.
#remove_method( ) removes the method from the receiver, but it leaves inherited methods alone.