Abs
Value = Abs ( Number AS Float )
计算一个数值的绝对值。
数值的绝对值是其正值,例如,-7的绝对值是7,+7的绝对值还是7。
示例
Print Abs(-2.5)
Print Abs(0)
' 利用Abs()函数能容易的获得两个数的差值:
Dim value1,value2 as integer
value1 = 100
value2 = 200
Print "The difference is "; Abs(value1 - value2)
value1 = -100
value2 = 200
Print "The difference is "; Abs(value1 - value2)
The difference is 100
The difference is 300
参见