Map

Difficulty:
Elementary

Tags:
enumerables

Instructions:
How would you create an array that contains the squares of all elements in a range?

Code:
assert_equal [1, 4, 9, 16], (1..4).map { ___ }

Your Solution

Ruby 1.9.3

Back to Problems