From: matt@... (matt neuburg) Date: 2008-03-30T13:50:10+09:00 Subject: Re: Extrange behaviour using "if XXX ..." and "XXX if ..." I�aki Baz Castillo wrote: > El Domingo, 30 de Marzo de 2008, Tim Hunter escribi�: > > > You must distinguish between parsing and execution. Ruby parses your > > program before Ruby executes your program. > > > > Ruby decides how to interpret the reference to a during parsing, before > > Ruby executes the if statements in your examples. Their success or > > failure has nothing to do with the decision. In this case > > > > a if a = "qweqwe" > > > > Remember parsing occurs from left to right. Ruby sees the reference to a > > to the left of the assignment to a. When Ruby first encounters a > > reference to a it assumes that since it has not yet seen any assigment > > to a, then a must be a method name. > > Ok, I understand. Thanks a lot. I asked the same question a few months ago, and got some great answers: Understanding this point has been very useful to me subsequently...! m. -- matt neuburg, phd = matt@tidbits.com, http://www.tidbits.com/matt/ Leopard - http://www.takecontrolbooks.com/leopard-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com