unknown wrote: > On Wed, Aug 18, 2010 at 1:57 PM, Bruce Wayner <winshocker / gmail.com> > wrote: > Add: $i = 1 > That's a start to cut down the amount of code you have to deal with > and still give pretty much the same result. i already done that Thanks take a look at the problem: A superhighway connects one large metropolitan area to another. A vehicle leaves the first city every 5-35sec. 20% of the vehicles have 1 passenger, 30% have 2 passengers, 10% have 3 passengers and and 10% have 4 passengers. the remaining 30% of the vehicles are buses, which carry 40 people. It takes 50sec-1min &10sec for vehicles to travel between the two metropolitan areas. How long does it take for 500 people to arrive in the second city. how can i set the passenger for each vehicle? like for example i input vehicles number: 5 how can set the passenger of vehicle 1 which is it only allow 1 passenger next for vehicle 2 (2 passenger) and vehicle 3 (3 passenger) and vehicle 4 (4passenger) and lastly the vehicle which have 40 passenger: how can i set all of those in loop? is it possible: Cheers, -- Posted via http://www.ruby-forum.com/.