TheAlgorithms-Ruby/maths/abs.rb
2021-01-08 17:14:52 -05:00

10 lines
170 B
Ruby

# frozen_string_literal: true
# Calculates the absolute value of a number
class Abs
def self.call(number)
return -number if number.negative?
number
end
end