Ruby/Range/include

Материал из Wiki.crossplatform.ru

Версия от 17:59, 13 сентября 2010; ViGOur (Обсуждение | вклад)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

The include Function can be used to check whether a particular number is within a range or not.

# The include function always will return a true or false. 
range1 = 1..100
puts range1.include? (6)
# This code returns true because range1 contains numbers from 1 to 100.