<< Prev        Next >>

ID : 224

Abs

Function

To return an absolute value.

Syntax

Abs(formula)

Guaranteed entry

Formula
Designate a numeric type data to set as an absolute value. Designate Integer Type data, Single Precision Real Number Type data or Double Precision Real Number Type data.

Return value

Return data of the same type as the data type designated in formula.

Description

An absolute value is returned.

Related Terms

Arithmetic Function

 

Attention

Array cannot be specified for the argument.

Example

'!TITLE "Acquiring Absolute Value"
' Acquire and display an absolute value of the value assigned to the variable
Sub Sample_Abs 

  Dim aaa As Integer
  Dim bbb As Integer
  Dim ccc As Integer
  Dim ddd As Integer

  ccc = -8
  ddd = 2

  ' Assign the absolute value of -2 to aaa
  aaa = Abs( -2 )

  ' Assign the absolute value of (ccc / ddd) to bbb
  bbb = Abs( ccc / ddd )

  ' Display "2" on the message output window
  PrintDbg aaa

  ' Display "4" on the message output window
  PrintDbg bbb 

End Sub

ID : 224

<< Prev        Next >>