From: "Kyle X." Date: 2011-04-02T04:29:13+09:00 Subject: Re: Simple array.each do |x| question Thank you all for your responses. I have a second part question. I still cannot get the array.each do || correct, so I have been having to use these long and unsophisticated while loops: ------------------------------------- n = 0 elements = [] while n != reference1.length x = REXML::XPath.match(doc,"//*[@id='#{reference2[n]}']/Coordinates/IfcLengthMeasure").map {|element| element.text} elements << x n=n+1 end n = 0 result = [] while n != elements.length a = 0 while a != elements[n].length x = elements[n][a].to_f result << x a = a+1 end n=n+1 end ------------------------------------ Any ideas on how to make these more concise by using .each? I have been trying many different things but cannot make it work. Thank you for your time. -- Posted via http://www.ruby-forum.com/.