abs

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;
}
This article is issued from Zdoom. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.