The difference between select and map methods

Here is a basic understanding of the .select and .map methods with real world analogies and coding examples.

.select  takes a block and creates a new array of the items the block evaluates to true only.

.map aka .collect  takes a block and creates a new array with all the items modified by the block. ** Map and Collect are exactly the same.

Example

 

(Visited 51 times, 1 visits today)