Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 453 Bytes

what_is_between.md

File metadata and controls

27 lines (22 loc) · 453 Bytes

Description

Complete the function that takes two integers (a, b, where a < b) and return an array of all integers between the input parameters, including them.

For example:

a = 1
b = 4
--> [1, 2, 3, 4]

My Solution

def between(a, b)
  (a..b).to_a
end

Better/Alternative solution from Codewars

def between(a, b)
  [*a..b]
end