From: Paul Lutus Date: 2006-11-25T04:47:32+09:00 Subject: Re: Bug in ruby? AliasX Neo wrote: > Well, I've spent the last hour or so debugging one of the stupidest > errors I have encountered with Ruby. It is a stupid error, but to say it diplomatically, the responsibility assignment is flawed. / ... > I have spent the last hour trying hundreds of different forms of this > code Except the one shown below. > and am getting the same exact error every time. I've come to the > conclusion that this must be some kind of bug in Ruby, I can not pull on > piece of logical evidence out of this. That is because you are not thinking hard enough. > So my last resort is you guru's here, what am I doing wrong? You are not breaking the problem down sufficiently. As others have commented, there are two operands for "+" and you have only looked at one of them. Do this: length = starting.length si = string.index(starting) if(length != nil && si != nil) istart = si + length end > Is there some kind of magical law I broke? Yes, as a matter of fact, there is. You assumed there was a flaw in the language before exhausting the more obvious possibility that the error is your own. > This application needs to get done > tonight, and I really can't afford anymore time on this tiny little bug. Famous last words. -- Paul Lutus http://www.arachnoid.com