Erlang - abs


Advertisements

The method returns the absolute value of the specified number.

Syntax

abs(X)

Parameters

X - A value is specified for the absolute value function.

Return Value

The return value is the absolute value of the number.

For example

-module(helloworld). 
-export([start/0]). 

start() ->
   Aabs = abs(-3.14), 
   io:fwrite("~p~n",[Aabs]).

Output

When we run the above program, we will get the following result.

3.14
erlang_numbers.htm
Advertisements