From: "David A. Black" Date: 2009-10-30T22:52:07+09:00 Subject: Re: How do you get the tail end of a string? Hi -- On Fri, 30 Oct 2009, Bertram Scharpf wrote: > Hi, > > Am Freitag, 30. Okt 2009, 21:06:11 +0900 schrieb David A. Black: >> On Fri, 30 Oct 2009, Bertram Scharpf wrote: >>>> >>>> string[-index, index]. >>> >>> That's really ugly. You shouldn't have to mention `index' twice. >> >> I don't think there's anything wrong with it. It works well, and >> there's nothing stylistically wrong with using a local variable twice. > > What when it's a method call? Well, that would be the case I addressed in the part of my paragraph you deleted :-) >> If index is a method that does a (re)calculation every time, you'd >> want to cache it, but that's not the case in the example. David -- The Ruby training with D. Black, G. Brown, J.McAnally Compleat Jan 22-23, 2010, Tampa, FL Rubyist http://www.thecompleatrubyist.com David A. Black/Ruby Power and Light, LLC (http://www.rubypal.com)