[Wtr-general] for loop syntax??
Paul Carvalho
tester.paul at gmail.com
Wed Jul 19 12:20:05 EDT 2006
Ruby rocks! My fav is:
9.times {|x| puts x}
It doesn't get any clearer for me than just telling it how many times I want
it to loop without worrying about extra syntax that I'm likely to get
wrong.. ;)
On 19/07/06, Chris McMahon <christopher.mcmahon at gmail.com> wrote:
>
> On 7/19/06, mi <mdove at pheedo.com> wrote:
> > ahhhhhhhhhhh, That was it!!! I'm just NOT used to start an iteration
> > form 0:-( THANKS a million!!!!!!!!
>
> Ruby folks don't generally use for loops:
>
>
> 1.upto 9 do |x|
> puts x
> end
>
> ruby loop.rb
> 1
> 2
> 3
> 4
> 5
> 6
> 7
> 8
> 9
> >Exit code: 0
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20060719/31cef6d7/attachment.html
More information about the Wtr-general
mailing list