From: Vincent Stowbunenko Date: 2013-04-13T05:12:48+09:00 Subject: Trying to understand blocks I am confused about what is going on with this code: def foo yield("Jim") end def bar baz = lambda { |n| n.upcase } foo(&baz) end bar # => "JIM" From what I understand where this is going: 1. The method bar is being called. 2. Inside the bar method, the lambda function is being assigned to the baz variable, to upcase whatever is assigned to the variable n inside the lambda function. 3. I don't understand the use of ampersand operator associated with the variable baz. Whatever that is, it is an argument for the foo method. 4. Inside the foo method, it uses a yield function with an argument "Jim". Somehow, the string "Jim" made it way to assign to the variable n, upcasing it. Can anyone help me clarify what this code is really doing? -- Posted via http://www.ruby-forum.com/.