Abs: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
No edit summary
Line 5: Line 5:
Abs returns the absolute value, or unsigned magnitude, of a numeric expression. The required parameter, ''number'', is any valid numeric expression. If ''number'' is NULL, Abs returns NULL.
Abs returns the absolute value, or unsigned magnitude, of a numeric expression. The required parameter, ''number'', is any valid numeric expression. If ''number'' is NULL, Abs returns NULL.


== Example ==
== Example (BASIC) ==


<pre>
<pre>
Line 12: Line 12:
Print "Abs(-2) = " & Abs(-2)
Print "Abs(-2) = " & Abs(-2)
Print "Abs(2) = " & Abs(2)
Print "Abs(2) = " & Abs(2)
</pre>
== Example (JavaScript) ==
<pre>
//Abs Example
//Abs returns the absolute value of a number.
Print "Abs(-2) = " + Math.abs(-2);
Print "Abs(2) = " + Math.abs(2);
</pre>
</pre>



Revision as of 12:15, 9 April 2013

Abs(number)

Description

Abs returns the absolute value, or unsigned magnitude, of a numeric expression. The required parameter, number, is any valid numeric expression. If number is NULL, Abs returns NULL.

Example (BASIC)

Rem Abs Example
'Abs returns the absolute value of a number.
Print "Abs(-2) = " & Abs(-2)
Print "Abs(2) = " & Abs(2)

Example (JavaScript)

//Abs Example
//Abs returns the absolute value of a number.
Print "Abs(-2) = " + Math.abs(-2);
Print "Abs(2) = " + Math.abs(2);

Output

Abs(-2) = 2
Abs(2) = 2

Related Items

Sgn