Ruby | Numeric angle() function
The angle() is an inbuilt method in Ruby returns 0 if the number is positive, else it returns a float value which is equal to pi.
Syntax: num.angle()
Parameters: The function needs a number.
Return Value: It returns 0 if the number is positive, else it returns a float value which is equal to pi. .
Example 1:
Ruby
# Ruby program for angle() method in Numeric # Initialize a number num = - 19 # Prints angle() of num puts num.angle() |
Output:
3.141592653589793
Example 2:
Ruby
# Ruby program for angle() method in Numeric # Initialize a number num = 100 # Prints angle() of num puts num.angle() |
Output:
0