Project: Array Utilities Unit
Unit: DelphiDabbler.Lib.ArrayUtils
Record: TArrayUtils
Applies to: ~>0.1
class function Last<T>(const A: array of T): T;
static;Returns the last element of a non-empty array.
Parameters:
- A - The array on which to operate.
Returns:
- The required last element.
Precondition:
- A must not be empty. An EAssertionFailed exception is raised otherwise.
procedure Last_Eg;
var
A: TArray<Integer>;
begin
A := TArray<Integer>.Create(1, 2, 3);
Assert(TArrayUtils.Last<Integer>(A) = 3);
end;