Sometimes when programming, we trick our minds into thinking something is somethat it clearly isn t. One really good case of this is Ruby ||=. We like to think of it as set something if it doesn’t have a value - which is certainly not what it means (and not what it should mean).

Slow your mind down and consider this gotcha that will getcha every time:

1.9.2 > a = false
=> false
1.9.2 > a ||= nil
=> nil
1.9.2 > a
=> nil

And its cousin:

1.9.2 > a = false
=> false
1.9.2 > a || true
=> true

Try tracking that one down! Being explicit can be really helpful, as well as not letting your mind hold onto too many shortcuts for common patterns.