Proc and lambdas

I am confusing about Proc and lambdas.
I need to just find out the longest word in the given array using Proc
or lambda.

Can any one post the code,?

On 09/21/2012 11:38 AM, Venkat Ch wrote:

I am confusing about Proc and lambdas.
I need to just find out the longest word in the given array using Proc
or lambda.

Why is that a requirement?

Hi,

This is not a homework forum. Apart from that, your description is far
too vague to make anything useful out of it. Procs are just a tool, you
can use them in all kinds of ways. So saying “find the word using a
proc” is like saying “sort an array using methods”.

The usual solution to “get the smallest/biggest value” is to use the
method Enumerable#max_by (or min_by):

words = [
‘a’,
‘abc’,
‘abcde’,
‘ab’
]
puts words.max_by &:length

Suggested reading is on Blocks, Procs and Lambdas: http://bit.ly/NGQTjT

Have a nice day,

Brandon W.