Ruby | Range end() function
Last Updated :
18 Dec, 2019
The end() is an inbuilt method in Ruby returns the last element of the given range.
Syntax: range1.end()
Parameters: The function accepts no parameter
Return Value: It returns the last element of the given range.
Example 1:
range1 = ( 0 .. 10 )
puts range1. end ()
|
Output:
10
Example 2:
range1 = ( 10 .. 20 )
puts range1. end ()
|
Output:
20
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...