[][src]Static p5_sys::global::abs

pub static abs: AbsInternalType

Calculates the absolute value (magnitude) of a number. Maps to Math.abs(). The absolute value of a number is always positive.

Examples

function setup() {
  let x = -3;
  let y = abs(x);

  print(x); // -3
  print(y); // 3
}

Parameters

n number to compute