----- Original Message ----- From: "Sean Russell" <ser / germane-software.com> Newsgroups: comp.lang.ruby To: "ruby-talk ML" <ruby-talk / ruby-lang.org> Sent: Monday, July 08, 2002 11:05 PM Subject: Re: for ... else ... end > I feel like such a novice... but would someone explain to me why such a > construction would be necessary? Specifically, for ... else ... end. What > is the difference between: > > for x in (1..10) > puts x > else > puts "Done" > end > > and > > for x in (1..10) > puts x > end > puts "Done" My $0.02. Disclaimer: IDKP (I Don't Know Python). My understanding is that the for/else/end allows you to distinguish between 'normal' termination of a loop and 'early' termination. (Sometimes a useful thing, I think.) In other words, your examples above are exactly equivalent, since there is no way for the loop to terminate early. I can't think of an example right now, not even a contrived one, but now that I reflect on it, there are many times I want to detect 'why' a loop ended. Maybe this would help. Hal Fulton