3 ms·
Worth it for the memoization (I guess that's not really a word?) in Ruby. Cool new operator I did not know about.
by codyb 13y ago
Worth it for the memoization (I guess that's not really a word?) in Ruby. Cool new operator I did not know about.
- city41 13y agoIt's not a new operator, but rather the X= form, where `foo X= 4` is sugar for `foo = foo X 4` Just be careful with this in JavaScript, as the greater number of things that are falsy can bite you if you do `a = a || 10;`, which is a very common JS bug.
- cheald 13y agoWatch out for this with boolean values. If you are attempting to memoize a method that returns a boolean, it'll be re-evaluated if the last iteration returned false.