Lambda vs. Procs : How are values processed?


Test Code

def test

test #0utput

def test2
puts "dog"

test2 #output


End Test Code

Please explain the following:

  1. why the first proc did not evaluate "dog" as a string and return the string to output,
    but instead returned "=>dog"? What is the key in this case?

  2. When I ran both methods one after the other the only output I got was "dog".

  3. When I ran both methods and include an arbitrary inline call to a String object instance "dog" the out put was:



This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.