Abs Function

数値表式の絶対値を返します。

構文:


Abs (Number)

戻り値:

Double

パラメーター:

Number: 絶対値を求める数値表式。ゼロを含めた正の値については、そのままの数値が返され、負の値については、正の値への変換値が返されます。

下記の例は、Abs 関数を用いて 2 つの数値の差を求めています。どちらの値を先に入力しても、同じ結果が得られます。

Error codes:

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

ご支援をお願いします!