4 ms·
so.. is 10 'in' 10..100? is 100?
by newobj 11y ago
so.. is 10 'in' 10..100? is 100?
- VeejayRampay 11y ago10..100 is a Range in Ruby. 10..100 does include 100 (it includes both bounds). On the other hand 10...100 (note the three dots) does not.
- jschulenklopper 11y ago> On the other hand 10...100 (note the three dots) does not. reply > On the other hand 10...100 (note the three dots) does not. To be clear, 10...100 includes 10, but not 100. So, it includes one bound: the one mentioned first, the lower bound. (10...100).to_a => [10, 11, 12, 13, ... 98, 99]
- tom-lord 11y ago[1] pry(main)> 10..100 => 10..100 [2] pry(main)> (10..100).class => Range [3] pry(main)> (10..100).to_a => [10, 11, 12, 13, 14, ..., 99, 100]