From: Robert Dober Date: 2007-01-05T18:47:22+09:00 Subject: Re: How can I do this better? ------=_Part_21354_24032480.1167990438658 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 1/5/07, Sam Kong wrote: > > Hi, > > I wish this worked. > return v if v = @cache[i] #=> undefined local variable or method `v' Hi Sam that is too bad I did not know about that, good you showed us. Maybe you like the following code(1): v = @cache[i] and return v but I agree that return v if v = @cache[i] would be nicer (1) some people wondered recently why "or" and "and" have such low a precedence, I guess this example is a reason behind this. HTH Robert > I want "return statement" to stand out. Sorry I cannot do that Post-modification looks better for that. > So I call @cache[i] twice. > > How do you do it? > > Sam > > > Robert -- "The real romance is out ahead and yet to come. The computer revolution hasn't started yet. Don't be misled by the enormous flow of money into bad defacto standards for unsophisticated buyers using poor adaptations of incomplete ideas." - Alan Kay ------=_Part_21354_24032480.1167990438658--