abs

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
the abs of <number>
abs(<number>)
Summary

Returns the absolute value of a number.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
number

A positive or negative number, or any expression that evaluates to a number.

Example
abs(14)
the abs of -14
abs(firstNum - secondNum)
abs(secondNum - firstNum)
Values
NameTypeDescription
return

The abs function returns a positive number.

RelatedControl Structure: function
Glossary: negative, return
Function: trunc, round
Description

Use the abs function if you need to know the magnitude of the number and are not concerned about whether it is negative or not.

The absolute value of a number is that number's distance from zero. If the number is positive, its absolute value is just the number; if the number is negative, its absolute value is the negative of the number. Because of this, the absolute value of a number is always positive.

Tagsmath