From: Yossef Mendelssohn Date: 2008-05-15T03:03:37+09:00 Subject: Re: anding statements. On May 14, 12:28 pm, "Kyle Schmitt" wrote: > Mac, > If your two arguments were methods however, and the first one > succeeded, wouldn't you expect it to execute the second? The problem is that puts returns nil, which causes the boolean logic to short-circuit and not even bother with the second. I take that back. *A* problem is that puts returns nil. *The* problem is that you're trying to do too much on one line. if x % 2 == 0 puts 'even' return false end It's possible to use 'and' and 'or' and post-condition (statement modification) 'if' or 'unless' for clever flow control, but it often turns out messier-looking than you think. At least you weren't trying something like x % 2 == 0 and puts 'even' > On Wed, May 14, 2008 at 12:17 PM, Michael Linfield > > wrote: > > Consider the following: > > > x = 'word' > > z = nil > > > test = x && z # test == nil > > test = x and z # test == 'word' > > test = (x and z) # test == nil > > > Regards, > > > - Mac > > -- > > Posted viahttp://www.ruby-forum.com/. -- -yossef