From: Rolando Abarca Date: 2008-05-15T03:11:22+09:00 Subject: Re: anding statements. On May 14, 2008, at 1:06 PM, Kyle Schmitt wrote: > def something(x) > puts "#{x} is divisible by two" and return false if x%2==0 > puts "#{x} makes me happy" > true > end the problem here is that "puts" returns nil, so the && (and 'and') will not reach the next part of the chain, because all of it resolves to false: >> puts "something" something => nil >> puts("something") && puts("something else") something => nil >> def new_puts(str) >> puts(str) >> true # this will do the trick >> end => nil >> new_puts("something") && new_puts("something else") something something else => true so you either re-def puts or use your own implementation of puts, like I did in the example above. regards, -- Rolando Abarca M.