Use upto to create 3 threads : Thread.new « Threads « Ruby






Use upto to create 3 threads


1.upto(3) {|n| Thread.new { puts n }}

 








Related examples in the same category

1.Create threads in a while loop
2.Pass value into a thread
3.manipulate variables from the outer scope
4.Access the thread-local data from outside
5.True local variables (not accessible from outside)