From: Joel Wilsson Date: 2001-08-15T03:13:56+09:00 Subject: [ruby-talk:19715] and in postconditions Hi everyone, I've found something very strange. "and" doesn't seem to do what I expect it to do when used with postconditions. In Perl, however, it does. $ cat test.pl sub test($) { my $i = shift; print "TRUE!\n" and return true if ($i > 10); print "FALSE!\n"; return false; } print test(20), "\n"; print test(2), "\n"; $ perl test.pl TRUE! true FALSE! false $ cat test.rb def test i print "TRUE!\n" and return true if (i > 10) print "FALSE!\n" return false end print "#{test(20)}\n" print "#{test(2)}\n" $ ruby test.rb TRUE! FALSE! false FALSE! false $ ruby -v ruby 1.6.4 (2001-07-31) [i386-freebsd5.0] Could someone please explain why Ruby behaves like this? Is there a reason for it, or is it a bug? And matz, thank you for a wonderful language. It's the only language I actually enjoy rewriting and restructuring code in, because I always find new ways to improve the code by using language features I didn't previously understand what they were there for (or how powerful they were). Thanks, Joel Wilsson