From Clomosy Docs
No edit summary |
No edit summary |
||
| Line 11: | Line 11: | ||
i : Integer;<br> | i : Integer;<br> | ||
'''begin''' | '''begin''' | ||
MyForm := | MyForm := TclForm.Create(Self);<br> | ||
i := -1235; | i := -1235; | ||
ShowMessage('Before: '+ IntToStr(i)); | ShowMessage('Before: '+ IntToStr(i)); | ||
Revision as of 14:23, 3 April 2023
function Abs(Number Numeric type):Numeric type;
Returns the absolute value of an integer.
Syntax:
value := Abs(value);
Example:
Let's say you have a variable i. The type of this variable is assigned as integer. The value of this variable can be given an integer value. Here we have given a negative value. Finally, abs function was used to get the absolute value.
var i : Integer;
begin MyForm := TclForm.Create(Self);
i := -1235; ShowMessage('Before: '+ IntToStr(i)); //The absolute value of i is taken and put back to i. i:= Abs(i); ShowMessage('After: '+IntToStr(i));
MyForm.Run;
end;