From: Robert Klemme Date: 2007-11-16T19:12:03+09:00 Subject: Re: Yielding an object and caring about the result: the cousin of Object#tap 2007/11/16, Sean O'Halpin : > I also find myself using this pattern: > > if response = http.response # i.e. expecting nil or false on failure > response.foo > # etc. > else > ... > end I seriously dislike the pattern above for the following reasons: it can be easily misread as "if response == http.response" and there is no need to have an assignment inside an if condition. In this case I prefer an extra variable setter or using "and" if there is just one statement: response = http.response if response ... end response = http.response and puts response The situation is different with loops because there often this is the most elegant solution: while line = gets ... end Cheers robert -- use.inject do |as, often| as.you_can - without end