Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Ruby | Numeric rect() function

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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:




# Ruby program for rect()
# method in Numeric
  
# Initialize a number 
num = Complex(10, 6)
  
# Prints the rect part
puts num.rect()

Output:

10
6

Example 2:




# Ruby program for rect()
# method in Numeric
  
# Initialize a number 
num = Complex(18, 16)
  
# Prints the rect part
puts num.rect()

Output:

18
16
My Personal Notes arrow_drop_up
Last Updated : 06 Jan, 2020
Like Article
Save Article
Similar Reads