Posts Tagged “beginner”

Ruby Array Set Operators

intersection

Have you ever had an array that you only want to include unique elements?

In this example we’re combining list_1 and list_2, then removing duplicate entries using the #uniq method before assigning to the combined_list variable.

Another approach would be to not include duplicate elements all together using one of the array set operators: the union operator |.

Read More