Bang Methods in Ruby Language :
Hi today i would like to share some information regarding Bang methods in Ruby. Please take a look at following examples and give a try in rails console.
name = "JOHN"
p string = name.downcase # prints john, doesn't modify name
p name # name is still JOHN
Method which ends with exclamation mark in ruby is called as bang methods.
name = "JOHN"
p name.downcase! # prints john,modify name
p name # name becomes john after calling bang method
Hi today i would like to share some information regarding Bang methods in Ruby. Please take a look at following examples and give a try in rails console.
name = "JOHN"
p string = name.downcase # prints john, doesn't modify name
p name # name is still JOHN
Method which ends with exclamation mark in ruby is called as bang methods.
name = "JOHN"
p name.downcase! # prints john,modify name
p name # name becomes john after calling bang method
No comments:
Post a Comment