Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

First<T> class method

Project: Array Utilities Unit

Unit: DelphiDabbler.Lib.ArrayUtils

Record: TArrayUtils

Applies to: ~>0.1

class function First<T>(const A: array of T): T;
  static;

Description

Returns the first element of a non-empty array.

Parameters:

Returns:

Precondition:

Example

procedure First_Eg;
var
  A: TArray<Integer>;
begin
  A := TArray<Integer>.Create(1, 2, 3);
  Assert(TArrayUtils.First<Integer>(A) = 1);
end;

See Also