3 ms·
There is a tiny inaccuracy in this post: @value ||= "foo" is more efficient than @value = @value || "foo" As it actually evaluates as follows: @valu
by Argorak 15y ago
There is a tiny inaccuracy in this post:
@value ||= "foo" is more efficient than
@value = @value || "foo"
As it actually evaluates as follows:
@value || @value = "foo"
This is especially good when working with hashes, as the left hand side is only evaluated once, not twice.
- laserlemon 15y agoThank you for pointing this out. Addressed in the comments: http://collectiveidea.com/blog/archives/2011/06/21/the-billy-baldwin-of-conditional-assignment/#comment-form http://collectiveidea.com/blog/archives/2011/06/21/the-billy...