Logan Capaldo wrote:
> On Mar 6, 2006, at 11:14 AM, Paul Tsung wrote:
> 
>> .
>> end
>>
>> Is there a shorter way to do this?  Instead of typing all the variable
>> names, can I use a range to do this?  Like title(1..20)?
>>
>> Thanks for any help with this.
>>
>>
>> --  
>> Posted via http://www.ruby-forum.com/.
>>
> 
> I am confused, why not title_array = [ ruby, rails, typo, ..., ajax ]
> 
> However if really want to do this,  (I really think this needs a
> redesign though) you can do this:
> 
> title_array = []
> 
> (1..20).each do |i|
>      title_array << eval("title#{i}")
> end

Thank you for everyone's help with this.  The eval method is what I was 
looking for.  The contents for the variables are actually inside a 
database.  I just use title1 = ruby as an example.  Thanks again.


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