Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.mixmin.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!talisker.lacave.net!lacave.net!not-for-mail From: "Kyle X." Newsgroups: comp.lang.ruby Subject: How can I generate new variables? Date: Wed, 30 Mar 2011 19:42:00 -0500 Organization: Service de news de lacave.net Lines: 37 Message-ID: <33ba41ea1d06d357f353d2462a951026@ruby-forum.com> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1301532140 51746 65.111.164.187 (31 Mar 2011 00:42:20 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Thu, 31 Mar 2011 00:42:20 +0000 (UTC) X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 380643 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: <33ba41ea1d06d357f353d2462a951026@ruby-forum.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:1997 Hello, this is not so much a sketchup question as a Ruby one that I cannot figure out. What I am trying to do is create new variables that all have the same base name then add a number to make a series of variables named like wall1, wall2, wall3, ect. What I am trying to do is take an array, lets call it originalarray, which has say 64 objects in it, and create 8 smaller arrays from this. So array1 would be orginalarray[0-7], array2 would be originalarray[8-15], and so on for 8 new arrays. The problem is I do not know the length of the original array, as it is being populated by data from an xml sheet, but I know the multiple of how it is being created, ie by multiples of 8. I have been trying to do this using loops doing something like: n=0 while n != originalarray.length/8 n=n.to_s array+n=originalarray[0..7] n=n.to_i n=n+1 end I realize that is doesn't work at all in that you cannot make variables like this, I am just trying to give a better picture of what my goal is. So I am wondering is it possible to accomplish this at all, and if so how? Or is there a much easier way to do this using classes or some other method to accomplish the same goal? Any help would be greatly appreciated. Thank you in advance for your time. -- Posted via http://www.ruby-forum.com/.