Ruby (and generally code) beginner question:

I'm reading about threads in the pickaxe book.
To understand what's going on I was trying to run the following code:
===============
threads=[]
3.times do |i|
  threads[i]=Thread.new do
    puts i
  end
end
===============

It ran ok, but nothing appeared on the console. I was expecting each of
the three threads to print 'their' position in the thread array.
The point of this exercise was to look at threads while they are working
concurrently, before calling the thread.join method.

I guess I'm misunderstanding the concept because this doesn't work.

my questions are:
1. what's wrong with the above code
2. can I write a program that will create M threads each of which
loops from 1 to N and all of them print concurrently to the console
something like "Thread #{m} is now on number #{n}"

Thanks.

-- 
Posted via http://www.ruby-forum.com/.