Posted almost 3 years ago. Visible to the public. Repeats. External content.

What Ruby’s ||= (Double Pipe / Or Equals) Really Does

||= and &&=

a ||= b a || a = b a &&= b a && a = b


a += b a = a + b a -= b a = a - b # Other operators, e.g. Array#| (union) ary1 = ['a', 'b', 'c'] ary2 = ['c', 'd', 'a'] ary1 |= ary2 ary1 = ary1 | ary2 # => ['a', 'b', 'c', 'd']

makandra has been working exclusively with Ruby on Rails since 2007. Our laser focus on a single technology has made us a leader in this space.

Author of this card:

Thomas Klemm
Last edit:
almost 3 years ago
by Besprechungs-PC
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Thomas Klemm to makandra dev