From: aidy Date: 2008-04-02T21:15:04+09:00 Subject: Re: boolean and logging On 1 Apr, 14:23, Robert Klemme wrote: > 2008/4/1,aidy: > > > On 31 Mar, 16:56, Robert Klemme wrote: > > >  > The method invokes the block and uses the result to determine what to > >  > do (if or else). > > >  > Does that help? > > >  Surely does. Thanks Robert, your a linguist. > > Hm, not sure whether that was irony or not. :-) > > Maybe this helps: > > irb(main):001:0> def test(yes,no) > irb(main):002:1> if yield > irb(main):003:2> puts yes > irb(main):004:2> else > irb(main):005:2* puts no > irb(main):006:2> end > irb(main):007:1> end > => nil > irb(main):008:0> test("ok", "not ok") { 1 > 2 } > not ok > => nil > irb(main):009:0> test("ok", "not ok") { 1 < 2 } > ok > => nil > irb(main):010:0> test("ok", "not ok") > LocalJumpError: no block given >         from (irb):2:in `test' >         from (irb):10 >         from :0 > irb(main):011:0> > > Kind regards > > robert > > -- > use.inject do |as, often| as.you_can - without end Wasn't ironic Robert, I studied #yield and blocks when you mentioned them. It was exactly what I was looking for. Probably one of the most powerful assets of Ruby and I missed it. Cheers Aidy