From: Xiong Chiamiov Date: 2008-09-11T08:54:27+09:00 Subject: pass by reference in each loop I have a list of variables that I need to pass through a modifying function. Rather than specify for each one, I have them in an array, and I loop through the array: wml_needed = [@question, @answer_explanation] wml_needed.each {|chunk| chunk = wml(chunk)} The problem is that, unlike practically everything else in Ruby, each loops don't pass by reference, so my assignments get lost. Just to make sure, calling the function directly *does* work as expected: @question = wml(@question) In PHP, I can add an ampersand (&) to the name (chunk, in this example) to pass by reference instead of by copy; is there something similar in Ruby, or should I be approaching this with a different method? I realize that there are only two items in this example, but I'm building for having many more. -- Posted via http://www.ruby-forum.com/.