Procs and Lambdas • Exercise 1/4

Create a Proc

00:00
0
20 points

Instructions

Create a function make_multiplier that takes a number and returns
a Proc that multiplies its argument by that number.

Create a Proc with:
```ruby
Proc.new { |x| x * 2 }

or

proc { |x| x * 2 }

or

->(x) { x * 2 } # This is actually a lambda
```

Call a Proc with .call(arg) or .(arg) or [arg].

Example:
ruby
double = make_multiplier(2)
double.call(5) # => 10

Your Code

Results

Click "Run Tests" to see results