pls ignore previous post.
my very bad. sorry for noise.

kind regards -botp

ps: and yes, block is not executed. I was looking for nil, and irb got me...


#-----Original Message-----
#From: Pe, Botp [mailto:botp / delmonte-phil.com] 
#Sent: Saturday, October 08, 2005 12:45 PM
#To: ruby-talk ML
#Subject: Re: "downto" the nitty-gritty
#
#zetetic [mailto:tomascabeza / gmail.com] 
#
##1.downto(1) {|i| puts i}
##=> 1
##
##1.downto(2) {|i| puts i}
##=> 1
##
##Is this right?  The block is always executed once, even when 
#the limits
##would suggest otherwise? 1.upto(0) does the same thing...
#
#imho, yes.
#so for start.downto(limit), it may never get to the limit but 
#it always gets to start.
#
#are you thinking something like,
#
#start.downto(limit){|i| puts i}  if start>=limit
#
#if yes, you can modify downto or create own downto. 
#
#something like,
#
#:0> class Fixnum
#:1>   def downto(limit=self)
#:2> 	   super if self>=limit
#:2>   end
#:1> end
#=> nil
#
#:0> 3.downto(1) {|x| puts x}
#3
#2
#1
#=> 3
#:0> 3.downto(3) {|x| puts x}
#3
#=> 3
#:0> 3.downto(4) {|x| puts x}
#=> nil
#
#thanks and kind regards -botp
#
#
#
#
#
#