Array Head

Get the first n elements of an array.

Code

General
arr.first(n)

Parameters

Array

Number of elements

Server

More Ruby Snippets