Matteo Serpentoni Matteo Serpentoni - 5 months ago 66
Swift Question

Remove first n elements from array of Int in Swift

How can I remove the first

n
elements from an array of
Int
in Swift?

For example:

var array = [0, 1, 2, 3, 4, 5, 6]
let n = 4


The result array contains these elements:

[4, 5, 6]

Answer
let result = array.dropFirst(n)
Comments