"Tore Darell" <tored / stud.ntnu.no> schrieb im Newsbeitrag
news:7bffddce.0305301538.49737a54 / posting.google.com...
> Emmanuel Touzery <emmanuel.touzery / wanadoo.fr> wrote in message
news:<200305260838.02882.emmanuel.touzery / wanadoo.fr>...
> > Hello,
> >
> > it's a newbie question...
> > i wanted to do something like:
> >
> > result1 = [1, 2, 3].find { |e|
> > if e == 2
> > return true
> > else
> > return false
> > end
> > }
> > (with several if/else one in each other rather than one big condition,
for
> > code readability)
>
> Can't you just do:
>
> [1, 2, 3].find{|e|
>     if e == 2
>         true
>     else
>         false
>     end
> }

If you're proposoing a simplification then why not directly

[1, 2, 3].find {|e| e == 2 }

    robert