Ruby | Range inspect() function
Last Updated :
19 Mar, 2024
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:
range1 = ( 0 .. 10 )
puts range1.inspect()
|
Output:
0..10
Example 2:
range1 = ( 12 .. 14 )
puts range1.inspect()
|
Output:
12..14
Share your thoughts in the comments
Please Login to comment...