Tim Greer
12/23/2008 7:53:00 PM
Just Another Victim of the Ambient Morality wrote:
> 0.upto(10){ |i| puts i }
>
> ...I will get 11 lines of output
Because 0 to 10 is 11 numbers. If you want 10 numbers, use 1.upto(10)
If you want different behavior, you can use a different looping method,
or use post or pre increment, depending if you want it to display the
last element or not.
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!