From: Kyle Schmitt Date: 2008-05-15T02:06:43+09:00 Subject: anding statements. This is odd, I was trying to use "and" to chain together some statements, which I thought would work, but it ends up, it doesn't. I tried "and", and was surprised that it didn't execute the second half of the statement I tried "&&" with some extra parenthesis just to see (although I was pretty sure and was syntactic sugar for &&), and still no joy. I tried "&", and it works with some statements, but not with return statements. I know I can do this using a multi-line if, but I'm rather fond of single line, sentence like statements. I also tried "or", but that makes for slightly nonsensical statement, so I'm leaving out that option. #This works, but makes a cumbersome statement. #puts "#{x} is divisible by two" or return false if x%2==0 It begs the question, just how does and work, if it doesn't continue executing the right half of a statement, even when the left half was fine? Thanks, Kyle def something(x) puts "#{x} is divisible by two" and return false if x%2==0 puts "#{x} makes me happy" true end def something_different(x) (puts "#{x} is divisible by two")&&(return false) if x%2==0 puts "#{x} makes me happy" true end def something_that_doesnt_work(x) (puts "#{x} is divisible by two")&(return false) if x%2==0 puts "#{x} makes me happy" true end def something_longer(x) if x%2==0 puts "#{x} is divisible by two" return false end puts "#{x} makes me happy" true end