Abs Function

Category: GUI » Visual Basic 6 » Function

Description: Returns a value of the same type that is passed to it specifying the absolute value of a number Syntax: Abs(number)

ParametersDescription
number Required. A numeric expression

Return Data Type: Variant (Double | Integer | Long) Usage / Example Code:

StatementResult / ValueRemark / Note
Abs(1) 1  
Abs(533) 533  
Abs(34.57) 34.57  
Abs(-1) 1  
Abs(-533) 533  
Abs(-34.57) 34.57  
Abs(0) 0  
Abs(unknown) 0 uninitialized variable
Abs(null) Null  
Abs("string") Error Run-time error 13: type mismatch
Abs(True) 1 True - non zero
Abs(False) 0 False - zero

Related Articles:

Tags: Math Functions, vb6