abs(int)

From NWN Lexicon
Jump to navigationJump to search

Get the absolute value of a number.

int abs(
    int nValue
);

Parameters

nValue
Integer to return the absolute value of.

Description

Returns the absolute (non-negative, numeric distance from the number 0) value of nValue.

Version

1.22

Example

int nHigh = 12;
int nHighAbs = abs(nHigh);
//nHighAbs equals 12, the distance from 0

int nLow = -9;
int nLowAbs = abs(nLow);
//nLowAbs equals 9, the distance from 0

See Also

functions:  GetAngleBetweenLocations

 author: Charles Feduke, editor: Jeff Lindsey