From: Bob Showalter Date: 2006-12-21T05:36:00+09:00 Subject: Re: range question On 12/20/06, chen li wrote: > Hi all, > > I want to create an array as following: > a4=['name 1','name 2'...'name 20']. > > It looks like a range for me. But I can't find a > method in class Range to create this array. Here is my > script I am not sure if this the Ruby way to do this. > Any inputs? Range has a to_a method, but it won't work for 'Name 1'..'Name 20' (it does for 'Name 01'..'Name 20' as pointed out). I would use arr = (1..20).collect{|i| "name #{i}"}