加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

小写和小写之间的区别!在Ruby中

发布时间:2020-12-16 21:41:42 所属栏目:百科 来源:网络整理
导读:我只是在学习 Ruby,我不太明白几种 Ruby方法之间的差异,有没有’
我只是在学习 Ruby,我不太明白几种 Ruby方法之间的差异,有没有’!’最后.有什么不同?为什么我会用另外一个?

解决方法

最后有感叹号的方法通常被称为爆炸方法.爆炸方法不一定修改其接收器,并且不保证没有感叹号的方法不会.

这在this blog post年都很好解释.引用帖子:

The ! in method names that end with !
means,“This method is dangerous”—or,
more precisely,this method is the
“dangerous” version of an otherwise
equivalent method,with the same name
minus the !. “Danger” is relative; the
! doesn’t mean anything at all unless
the method name it’s in corresponds to
a similar but bang-less method name.

The ! does not mean “This method changes its receiver.” A lot of “dangerous” methods do change their receivers. But some don’t. I repeat: ! does not mean that the method changes its receiver.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读