Sign in Join
FPDoc Onlineexperiment

Abs function

In unit System

Calculate absolute value.

Declaration

pascal
function Abs(l: LongInt): LongInt

Description

Abs returns the absolute value of a variable. The result of the function has the same type as its argument, which can be any numerical type.

Errors

None.

See also

Example: ex1

pascal
Program Example1;

{ Program to demonstrate the Abs function. }

Var
  r : real;
  i : integer;

begin
  r:=abs(-1.0);   { r:=1.0 }
  i:=abs(-21);    { i:=21 }
end.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.