Ruby | Numeric abs() function
Last Updated :
19 Mar, 2024
The abs is an inbuilt method in Ruby returns the absolute value of a number.
Syntax: num.abs
Parameters: The function needs the number whose absolute value is to be returned.
Return Value: It returns the absolute value of a numbers.
Example 1:
Output:
19
Example 2:
Output:
100
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...