Merge and unique elements in arrays
Traditional way:
arr = ([1,2,3] + [3,5]).uniq
My way:
arr = [1,2,3] | [3,5]
Written by Zolzaya Erdenebaatar
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Related Tags
#ruby
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#