From: Rubic Date: 2007-04-09T15:49:08+09:00 Subject: Nesting Array loops I new to Ruby and I have lost touch with whatever little programming I did know a few years back. Sorry if this is a lame question. How does one nest arrays? I want to check every element of the array and compare it against rest of the elements of that array for repeat occurences. but for now I did be happy if I can get to even print the 2 values, hence 'puts #i, #j' in the code. f = File.open("iplist.txt") f1 = File.open("iplist.txt") f.each { |i| f1.each { |j| puts "#{i}, #{j}" } } With the above code I only get output of one successful iteration of f.each and it stops and doesnt continue for the rest of the values of f.each. Surprisingly this works... (0..5).each { |i| (0..4).each { |j| puts "#{i}, #{j}" } } 00 01 02 03 04 05 10 11 12 ......etc whats the difference between the codes thats causing this error? They are both arrays aint it? Thanks. :) -- Posted via http://www.ruby-forum.com/.