Ruby Array Map or collect
You can process every element in Ruby array using a loop or you may use ruby Array map or collect (Map and Collect are different names for same function). The Second and fourth print statements in the next example will print [2, 3, 4, 5, 6]. The functions that end with ! will modify the original array itself since it is destructive. The first and third will print the array [1, 2, 3, 4, 5] since the method map or collect did not change the array itself (it did not end with !)








