From: Robert Klemme Date: 2008-03-04T18:05:01+09:00 Subject: Re: and statement 2008/3/4, loveajax@gmail.com : > Hi, > > I found the following statement in routing.rb of rails framework. I > haven't seen this kind of usage anywhere. Can somebody tell me what > does this statement do? I am particularly interested in knowing how > 'and' behaves here. > > result = route.recognize(path, environment) and return result If /result/ is not /nil/ and not /false/ it will be returned here. Otherwise control flow proceeds to the next line. Try it out in IRB irb(main):001:0> def t(x) x and return x; 'not_returned' end => nil irb(main):002:0> t 1 => 1 irb(main):003:0> t 2 => 2 irb(main):004:0> t false => "not_returned" irb(main):005:0> t nil => "not_returned" irb(main):006:0> t true => true irb(main):007:0> Kind regards robert -- use.inject do |as, often| as.you_can - without end