abs

From ZDoom Wiki
Revision as of 21:58, 17 July 2008 by Gez (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function can be used to return the absolute value of a negative integer.

function int abs (int x)
{
    if (x < 0)
        return -x;

    return x;
}