I know that Ruby has many methods, especially on array or array like objects, for example sort
or flatten
. However, these methods also have a twin (the one with an exclamation mark) like sort!
and flatten!
.
Now my questions are:
- What is the difference between
flatten
andflatten!
(destructive flatten)? - A more general question, why is it called destructive?