Alex Ciarlillo wrote: > > threads = [] > breakfast = ['breakfast', '12:00:a', '11:00:a'] > lunch = ['lunch', '11:01:a', '4:00:p'] > dinner = ['dinner', '4:01:p', '11:59:p'] > periods = [breakfast, lunch, dinner] > locations = [0,1,2,3,4,5] > for period in periods > threads << Thread.new(period) { > puts "This threads variables: #{period[0]} #{period[1]} > #{period[2]}" < snip> > > So any ideas on why this is? Also, anyone know a shorter/cleaner way to > setup the 4 arrays of data I'm using for the threads? > Thanks, > -Alex Alex, Your thread is not passing it's constructor arg to the block as you are not accepting it.. try: threads << Thread.new(period) do | period| puts "This threads variables: #{period[0]} #{period[1]} end p.s It's idiomatic to use do.. end for multiline blocks vs {}.. see Pragmatic Guide to Ruby, Thomas, Hunt as for making the arrays simpler, you could do: periods = [%w(breakfast, 12:00, 13:00), %w(lunch, 14:00, 15:00), %w{supper, 16:00, 17:00)] -- Posted via http://www.ruby-forum.com/.