Ruby/Array/Array Subtraction
Материал из Wiki.crossplatform.ru
(Различия между версиями)
ViGOur (Обсуждение | вклад) м (1 версия: Импорт выборки материалов по Ruby) |
Текущая версия на 18:01, 13 сентября 2010
Array Subtraction and Difference
# You can compare two arrays by subtracting one against the other. # This technique removes any elements from the main array that are in both arrays: x = [1, 2, 3, 4, 5] y = [1, 2, 3] z = x - y puts z.inspect