From: jweirich@... Date: 2001-12-31T15:26:25+09:00 Subject: [ruby-talk:29817] Re: Proc.class vs yield >>>>> "Michael" == Michael Lucas-Smith writes: Michael> Otherwise, you could end up writing some code along the lines of: Michael> def childrenOf (aPersonName, people) Michael> catch (:found) { |person| return person.children } Michael> catch (:none) { return Array.new } Michael> people.detect { |person| person.name = aPersonName } Michael> end Michael> but now the method is backwards and counter intuitive. How about ... ? def children_of(name, people) if person = people.detect { |who| who.name == name } person.children else Array.new end end -- -- Jim Weirich jweirich@one.net http://w3.one.net/~jweirich --------------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)