From: nickb@... (Nick Bensema) Date: 2001-02-28T08:40:05+09:00 Subject: [ruby-talk:11725] Re: assert() library in Ruby? In article , Dave Thomas wrote: >"Aristarkh A Zagorodnikov" writes: > >> > DEBUG = false # or true >> > >> > def assert >> > if DEBUG >> > result = yield >> > raise "Assertion failed" if !result >> > end >> > end >> def assert >> raise 'assertion failed' unless yield if DEBUG >> end > >Well, if brevity trumps clarity, > > def assert > DEBUG && !yield && raise('assertion failed') > end def assert;DEBUG&&!yield&&raise('assertion failed');end if brevity>clarity -- Nick Bensema ICQ#2135445 ==== ======= ============== AVOID MISSING BALL TO SCORE