On 5/30/09, rzed <rzantow / gmail.com> wrote: > Caleb Clausen <vikkous / gmail.com> wrote >> Basically, it makes the end keyword optional. If you leave off >> the end, the preprocessor inserts an end for you at the next line >> indented at or below the level of indentation of the line which >> started the scope. > > If I'm reading this right, given > x.foreach ... > if ... > while ... > do_something > something_else > > ... would pop an end at the level of the 'while' only. You really I guess you're reading it right, but I didn't write it right. Endless.rb in fact does operate in the way you want; all three constructs would be ended. But I see now that my description implies only one end will be added. Roger Pack wrote: > Which makes me wonder > how does it differentiate between that and > > > x.foreach ... > > if ... > > while ... > > do_something > > .something_else > > becoming > > x.foreach ... > if ... > while ... > do_something > end > end > end.something_else > > is the "." special case? Currently, this case causes an error in endless.rb. It runs through endless.rb just fine, but the output isn't legal ruby. Every end added is followed by a semicolon.