Most but not all bang methods modify the receiver in-place. But that
is
not the "meaning" of the bang.
The implication of the bang is that the method is more dangerous or
more of
a special case. The exit! method, for example, exits without running
the
exit handlers.
Another, hard learned, lesson is that bang methods may also return
something else than the reciever (e.g. nil to signify no change). This
is needed since you no longer have the original object to compare to.
The non-bang variants return something more appropriate (like a copy of
the reciever).
This effectively means you must never chain method calls past bang
methods.
array.select{|x| x>2 }.sort!.reverse! # very bad and may raise a
# "nil does not respond to
..."
# exception
array = array.select{|x| x>2 }.sort.reverse # the safer way to do this