Mega Code Archive

 
Categories / Ruby / Language Basics
 

If a method name ends in an exclamation point (!), as in delete!

it indicates that the method is destructive,  it makes changes in place to an object rather than to a copy.  It changes the object itself.  the difference in result between the String methods delete and delete!: der_mensch = "myValue!" # => "myValue!" der_mensch.delete( "!" ) # => "myValue" puts der_mensch # => myValue! der_mensch.delete!( "!" ) # => "myValue" puts der_mensch # => myValue