Ruby | Numeric angle() function
Last Updated :
19 Mar, 2024
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
num = - 19
puts num.angle()
|
Output:
3.141592653589793
Example 2:
Ruby
num = 100
puts num.angle()
|
Output:
0
Share your thoughts in the comments
Please Login to comment...