The 'it' Parameter • Exercise 1/3

Using 'it' in map

00:00
0
20 points

Instructions

Ruby 3.4 introduced it as a shorthand for single-parameter blocks.

Instead of:
ruby
[1, 2, 3].map { |n| n * 2 }

You can write:
ruby
[1, 2, 3].map { it * 2 }

Create a function double_all that doubles each number using it.

Your Code

Results

Click "Run Tests" to see results