Array Operations in Ruby

Basic Array Operations in Ruby
`a = [4,3,7,5,2,7]a1=['Mon','Tue','Wed','Thu','May']a2=['Jan','Feb','Mar','Apr','May'"Array Operations""Arry A : #{a}""Arry A1 : #{a1}""Arry A2 : #{a2}""1.1. Multiply with Int (A1*2): #{a1*2} ""1.2. Multiply with String (A*h)#{a*"h"}""2.Concatenation(+) : A1 + A2  :#{a1+a2} ""3.Append  : A1 << A2  : #{a1<<a2} "#Array appended so we have to reset a1a1=['Mon','Tue','Wed','Thu','May'"4.Union   : A1 | A2  : #{a1|a2} ""5. Intersection (A1&A2) :#{a1&a2}""6.1 Difference A1 - A2 : #{a1-a2}""6.2 Difference A2 - A1 : #{a2-a1}""7. Comparison (A1==A2) : #{a1==a2}""8. Transforming (A.map { |i| i + 1 }) : #{a.map { |i| i + 1 }}"# select even numbers"9. Filtering A.select {|number| number % 2 == 0} : #{a.select {|number| number % 2 == 0}}""10. Deleting (A.delete_if{|i| i < 5 }) : #{a.delete_if{|i| i < 5 }}"`
Output
```Array Operations
Arry A : 437527
Arry A1 : MonTueWedThuMay
Arry A2 : JanFebMarAprMay
1.1. Multiply with Int (A1*2): MonTueWedThuMayMonTueWedThuMay
1.2. Multiply with String (A*h)4h3h7h5h2h7
2.Concatenation(+) : A1 + A2  :MonTueWedThuMayJanFebMarAprMay
3.Append  : A1 << A2  : MonTueWedThuMayJanFebMarAprMay
4.Union   : A1 | A2  : MonTueWedThuMayJanFebMarApr
5. Intersection (A1&A2) :May
6.1 Difference A1 - A2 : MonTueWedThu
6.2 Difference A2 - A1 : JanFebMarApr
7. Comparison (A1==A2) : false
8. Transforming (A.map { |i| i + 1 }) : 548638
9. Filtering A.select {|number| number % 2 == 0} : 42
10. Deleting (A.delete_if{|i| i < 5 }) : 757```