From: Phrogz Date: 2007-09-24T12:00:03+09:00 Subject: Re: foo || 0 will cause exception but not for himself On Sep 22, 2:51 pm, 7stud -- wrote: > Gavin Kistner wrote: > > On Sep 22, 7:26 am, SpringFlowers AutumnMoon > > wrote: > >> so how about just a method not inside a class, can it be named "foo=" as > >> well? if so, how does Ruby know foo=1 is really an assignment or a > >> method call foo=(1)? > > >> Ruby doesn't seem to like "foo=" as a method: > > > self.foo = 10 > > def foo=(val) > "hello" > end > > puts self.foo = 10 #10 Er, what's your point? Methods whose names end with a '=' character always return the value 'assigned' to them, not the last expression in the method. How is that relevant to this discussion of how to invoke them, and the scope and determinatino of variables versus methods?