Jan Yo wrote in post #1152468: > Is there a more compact way to do a nested each ? > > value.each do |x| > x.data.each do |y| > puts 'x: ' + x + ' y: ' + y > end > end > > That is can this be reduced to one or two lines?
value.each { |x| x.data.each { |y| puts 'x: ' + x + ' y: ' + y } } There, one line... Seriously though that is already about as compact a form as I'm aware of. What makes you think it should be condensed any further? As you can see my compacted version is already losing clarity and is harder to read, and understand it's purpose, than the original format. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/bf76b55e8576fe75dda49b3ed97aaab0%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.