官术网_书友最值得收藏!

Give it a bang!

Before we end this guide, I want to discuss something you may have noticed when it comes to Ruby methods. There are a number of methods that have similar names, with the only difference being that one method will have a ! symbol and the other does not.

The ! symbol is called bang in Ruby. So if you see a method such as my_method!, out loud you'd say my_method bang.

Let's take a look at an example of how bang is used for the upcase method. The main difference between the two methods is that the bang version will permanently change the value of the variable that the string was stored in.

In general, when the ! symbol is used at the end of a method, it means the original value or string is being changed.

主站蜘蛛池模板: 汕尾市| 桐柏县| 北京市| 垫江县| 普定县| 营口市| 四会市| 广昌县| 邳州市| 凌源市| 南皮县| 工布江达县| 哈巴河县| 北碚区| 缙云县| 临潭县| 萨嘎县| 逊克县| 仁寿县| 青田县| 肇庆市| 大宁县| 吴川市| 怀来县| 钦州市| 德格县| 连山| 化州市| 太保市| 讷河市| 手游| 团风县| 永昌县| 辽宁省| 巴彦淖尔市| 正安县| 神农架林区| 双牌县| 德昌县| 漯河市| 禹州市|