Hi,

I think this should do the job
nb-=1 if contact.select{|c| c==parameter}.any?

it will return nb-1 if any contact matches parameter, or nil if none  
match

cheers,
Dave


On 18/02/2007, at 10:45 PM, Josselin wrote:

> I wrote this code that's running well..
>           origin = false
>           contact.each {|c|  origin = true  if c.from == parameter }
>           nb -= 1 if origin
>
> is there any way to write it in one line ?  (exiting from the bloc  
> when the condition is true)
> something like :
>           contact.each {|c|  nb -= 1; exit;  if c.from == parameter }
>
> tfyl
>
> joss
>
>
>