Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Range to Array

  • to_a
numbers = (2..7).to_a
p! typeof(numbers)
p! numbers
typeof(numbers) # => Array(Int32)
numbers # => [2, 3, 4, 5, 6, 7]