builtins/or_assign_parens.rb
tests/_examples/builtins/or_assign_parens.rb in the metorex repository.
# ||=
x = nil
x ||= 42
puts x
x ||= 99
puts x
# &&=
y = true
y &&= false
puts y
z = false
z &&= true
puts z
w = "hello"
w &&= "world"
puts w
Output:
42
42
false
false
world