Benx Shen's personal annotations on this page
-
In Ruby, methods that end with an exclamation mark (also called a "bang") modify the object. For example, the method
upcase!changes the letters of a String to uppercase.>> comedian.upcase!
=> "STEPHEN COLBERT"Since both of the variables
comedianandfavorite_comedianpoint to the same String object, we can see the new, uppercase text using either variable.>> comedian
=> "STEPHEN COLBERT"
>> favorite_comedian
=> "STEPHEN COLBERT"
This link has been bookmarked by 1 people . It was first bookmarked on 24 Oct 2009, by Benx Shen.
-
-
In Ruby, methods that end with an exclamation mark (also called a "bang") modify the object. For example, the method
upcase!changes the letters of a String to uppercase.>> comedian.upcase!
=> "STEPHEN COLBERT"Since both of the variables
comedianandfavorite_comedianpoint to the same String object, we can see the new, uppercase text using either variable.>> comedian
=> "STEPHEN COLBERT"
>> favorite_comedian
=> "STEPHEN COLBERT"
-

Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.