Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Perl

Idiom #355 Absolute value

Assign to y the absolute value of the number n

$y = abs($n);
import "math"
y := math.Abs(x)

x and y have type float64

New implementation...
< >
programming-idioms.org