instance method
Integer#abs
() -> ::Integer
abs → integer
numeric.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/numeric.rb, line 137
def abs
Primitive.attr! :leaf
Primitive.cexpr! 'rb_int_abs(self)'
end
Returns the absolute value of self.
Example
(-12345).abs # => 12345 -12345.abs # => 12345 12345.abs # => 12345