Author Topic: ABS dont work?  (Read 1142 times)

0 Members and 1 Guest are viewing this topic.

Offline soldat-game

  • Camper
  • ***
  • Posts: 402
ABS dont work?
« on: December 18, 2016, 10:10:50 am »
Code: [Select]
procedure DDD();
var test2:integer;
begin
test2:=abs(-22);
end;
Error: Type mismatch

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: ABS dont work?
« Reply #1 on: December 18, 2016, 03:27:10 pm »
abs returns floating point value, can't be assigned to integer directly. Try
Code: [Select]
if x < 0 then x := -x;

Offline soldat-game

  • Camper
  • ***
  • Posts: 402
Re: ABS dont work?
« Reply #2 on: December 18, 2016, 03:44:51 pm »