This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.
Name | abs() |
||
---|---|---|---|
Examples | int a = abs(153); // Sets 'a' to 153 int b = abs(-15); // Sets 'b' to 15 float c = abs(12.234); // Sets 'c' to 12.234 float d = abs(-9.23); // Sets 'd' to 9.23 | ||
Description | Calculates the absolute value (magnitude) of a number. The absolute value of a number is always positive. | ||
Syntax | abs(n) | ||
Parameters |
| ||
Returns | float or int |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.