Hi all
I'm still quite new to Ruby, and I wonder what's the easiest way to check if a number is in the range x..y?
E.g.
Is 10 in the range 5..123?
Thanks for help, Josh
Hi all
I'm still quite new to Ruby, and I wonder what's the easiest way to check if a number is in the range x..y?
E.g.
Is 10 in the range 5..123?
Thanks for help, Josh
nums = 5..123
if nums.include?(10)
puts "yes"
end
nums === 10 does the same.
range === val returns true if range.start <= val <= range.end
dirk.