Related Articles

Related Articles

Ruby | Range inspect() function
  • Last Updated : 06 Jan, 2020

The inspect() is an inbuilt method in Ruby returns the range object in a printable form

Syntax: range1.inspect()

Parameters: The function accepts no parameter

Return Value: It returns the range object in a printable form

Example 1:



filter_none

edit
close

play_arrow

link
brightness_4
code

# Ruby program for inspect()
# method in Range 
  
# Initialize range 
range1 = (0..10)
  
# Prints the printable form 
puts range1.inspect()

chevron_right


Output:

0..10

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Ruby program for inspect()
# method in Range 
  
# Initialize range 
range1 = (12..14)
  
# Prints the printable form 
puts range1.inspect()

chevron_right


Output:

12..14
My Personal Notes arrow_drop_up
Recommended Articles
Page :