Erlang – abs

Erlang abs

In this guide, we will discuss abs in Erlang. 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

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply