From: Martin DeMello Date: 2006-11-22T20:15:40+09:00 Subject: Re: Bug in ruby? On 11/21/06, AliasX Neo wrote: > istart = string.index(starting) + starting.length [...] > undefined method `+' for nil:NilClass Other people have said this, but just to put it explicitly: Ruby has a message-passing object model - every operation consists of a message sent to an object. Thus, there are no symmetrical operations - even binary operations like + translate internally to one object being sent to the other as part of a "+" message. Indeed, you could even write the above as istart = string.index.starting.+(starting.length) to make it explicit that there's a method call going on under the hood. One consequence of this is that when an exception or error is thrown, it is thrown from the context of the receiving object. Thus "undefined method `+' for nil:NilClass" means you have attempted to call nil.+(something), not something.+(nil). That should help greatly in debugging stuff. martin