Changes

Jump to: navigation, search

Advanced Ruby Arrays

673 bytes added, 16:22, 29 February 2008
Intersection, Union and Difference
</pre>
In this case, the new array is a copy of the ''operating_systems'' array with any items that were also present in the ''linux_systems'' array removed(we could say ''subtracted'' which would help explain the use of the minus sign to represent this operation). It is important to be clear on the point that we not simply removing duplicate entries with this operator, but rather removing items from the array specified by the left hand operand that are also present in the array specified by the right hand operand. This can be demonstrated by the fact that switching the operands gives us different results: <pre>linux_systems - operating_systems=> ["PCLinuxOS", "Ubuntu"]</pre> Here we have the a new array comprised of the ''linux_systems'' array items less any items also present in the ''operating_systems'' array.
== Identifying Unique Array Elements ==

Navigation menu