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

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.

主站蜘蛛池模板: 岢岚县| 宜昌市| 邵阳县| 古丈县| 永州市| 宁化县| 永嘉县| 神池县| 固安县| 遵义市| 河南省| 德惠市| 大厂| 靖远县| 高台县| 长宁区| 漠河县| 靖边县| 沙湾县| 北宁市| 克拉玛依市| 墨江| 洪湖市| 东乌珠穆沁旗| 吉木萨尔县| 萝北县| 利川市| 涡阳县| 津市市| 怀集县| 赤峰市| 永城市| 资中县| 合阳县| 武鸣县| 伊通| 苗栗县| 荃湾区| 于田县| 道真| 舟曲县|