nExpNumeric expression evaluated to obtain its absolute value.
AdvPL GuideAbs( <nExp> )Returns the absolute value of a number.
Returns the absolute value of a number. This page was created from the historical training material and structured for quick reference, with practical notes and cautious use in current Protheus environments.
Abs( <nExp> )nExpNumeric expression evaluated to obtain its absolute value.
Returns nRet, numeric, representing the absolute value of the supplied expression. The result is positive or zero.
User Function ExAbs()
Local nSeats := 12
Local nPeople := 15
Local nDifference := Abs(nSeats - nPeople)
MsgInfo("Difference: " + CValToChar(nDifference))
ReturnEven when nSeats - nPeople returns a negative number, Abs() returns the positive difference.
User Function Abs2()
Local nValue := -123.45
MsgInfo( Abs( nValue ) ) // Result: 123.45
ReturnThe function removes the negative sign and displays 123.45.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.