Answers for ":& ruby"

1

ruby &:

ar.map(&:reverse)
Posted by: Guest on August-25-2020
0

ruby &:

ar.map { |element| element.reverse }
Posted by: Guest on August-25-2020
0

ruby |=

# When working with arrays |= is useful for uniquely appending to an array.
>> x = [1,2,3]
>> y = [3,4,5]

>> x |= y
>> x
=> [1, 2, 3, 4, 5]
Posted by: Guest on December-15-2020

Browse Popular Code Answers by Language