Lotus Symphony 1.2


Abs 函數 [執行時期]

傳回數值表示式的絕對值。

語法:

Abs(Number)

回覆值:

Double

參數:

以下範例使用 Abs 函數計算兩個數值之差。數值的輸入順序不會影響計算結果。

下列範例使用 Abs 函數計算兩個值之間的差。首先輸入哪個值並不會影響結果。

錯誤代碼

5 無效的程序呼叫

範例:

Sub ExampleDifference

Dim siW1 As Single

Dim siW2 As Single

siW1 = Int(InputBox$ ("Please enter the first amount","Value input"))

siW2 = Int(InputBox$ ("Please enter the second amount","Value input"))

Print "The difference is "; Abs(siW1 - siW2)

End Sub


其他文件 | 商標