If a method name ends in an exclamation point (!), as in delete! : Reserved words « Language Basics « Ruby






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

 








Related examples in the same category

1.Ruby's reserved words
2.If a method name ends with a question mark (?), as in eql?, then the method returns a Boolean
3.If a method name ends in an equals sign (=), as in family_name=
4.Classes and modules begin with an upper case letter.