Ruby | Numeric rect() function
Last Updated :
19 Mar, 2024
The rect() is an inbuilt method in Ruby returns an array which consists of a real and an imaginary number.
Syntax: num.rect()
Parameters: The function needs the number whose real and imaginary part is returned.
Return Value: It returns an array which consists of a real and an imaginary number.
Example 1:
num = Complex( 10 , 6 )
puts num.rect()
|
Output:
10
6
Example 2:
num = Complex( 18 , 16 )
puts num.rect()
|
Output:
18
16
Share your thoughts in the comments
Please Login to comment...