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

pub static abs: AbsInternalType
Expand description

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