Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Filling a 2D array

Thread Tools

Filling a 2D array

Matthew Margolis
Posts: n/a
@tileArray =
@height.times {@tileArray.push,}

I was hoping that the above code would create a 2D array filled with
Tile objects.
In Tile#initialize I have the simple line puts "orange"
When I run the code only #{height} "orange"s are printed to the
terminal. I assume that my code is only creating one Tile object per
row, how would one go filling the 2D array with unique Tiles?

Thank you,
Matthew Margolis

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
int array filling MarsTeam C++ 0 10-15-2007 07:10 AM
Nested array filling well.. but tricky search back Josselin Ruby 0 09-24-2007 10:58 AM
Nested array filling bad.. Josselin Ruby 4 09-24-2007 10:19 AM
filling an array excepted first and last position... Josselin Ruby 11 10-21-2006 10:17 AM
Filling 2d array in less than O(n^2) time C++ 12 11-22-2005 04:46 AM