Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does .between? method means in Ruby?

Tags:

ruby

I have a exercise of the school and i can't resolve it. Can you help me? The problem is this:

Try using a method that takes two arguments - use the between? method to determine if the number 2 lies between the numbers 1 and 3.

I tried to find what is the .between? method but í couldn't find it. I just know that is a method

like image 614
German Rocha Avatar asked Jun 20 '13 18:06

German Rocha


1 Answers

The method is Comparable#between?, and you can use it like this:

2.between?(1, 3)
# => true
like image 146
Darshan Rivka Whittle Avatar answered Sep 22 '22 06:09

Darshan Rivka Whittle