English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Erlang abs method

Numbers in Erlang

This method returns the absolute value of the specified number.

Syntax

abs(X)

Parameter

X-Specify a value for the absolute value function.

Return Value

The return value is the absolute value of a number.

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

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

3.14

Numbers in Erlang