HH\ImmVector::take

Returns an ImmVector containing the first n values of the current ImmVector.

Description

public function take(
  int $n,
): ImmVector<Tv>

Returns an ImmVector containing the first n values of the current ImmVector.

The returned ImmVector will always be a proper subset of this ImmVector.

n is 1-based. So the first element is 1, the second 2, etc.

Parameters

  • int $n - The last element that will be included in the ImmVector.

Return Values

Examples

See Vector::take for usage examples.