-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Zoe Phoenix wrote:
| hm, let me re-phrase... I only have 9 items in that array, right?  How
| do I make the program continue through the array no matter how many
| items are in it without having to go and edit the array that comes after
| c_list?

Oh, indeed you can.Array provides the #each and #each_with_index methods:

irb(main):001:0> array = [1,2,3,4,5]
=> [1, 2, 3, 4, 5]
irb(main):002:0> array.each{|a| puts a}
1
2
3
4
5
=> [1, 2, 3, 4, 5]

The above is Array#each. It allows you to operate on each element of
your array.


irb(main):003:0> array.each_with_index{|a,b| puts a;puts b}
1
0
2
1
3
2
4
3
5
4
=> [1, 2, 3, 4, 5]

Here, you get the current index, too (that is the second variable, I've
called b). This, of course, works with Strings also (like your city names).

Together with the % (modulo) operator, you can test if the index can be
divided by 3 without a remainder, so that you can add a new line after
the third element.

If that doesn't help you write your own code, I'll be happy to provide
an annotated example again.

- --
Phillip Gawlowski
Twitter: twitter.com/cynicalryan

~ - You know you've been hacking too long when...
...after days with YACC, you start to parse your conversations.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkf8GB4ACgkQbtAgaoJTgL9zyQCeKQLqgqQeD0RVWNqfSTMvezGs
7s8An1+IBecl8DQREtIvJ/A9+68F5cyT
=gdIk
-----END PGP SIGNATURE-----