Try this,
irb(main):001:0> row = [["a","b","c"],["d","e","f"],["g","h","i"]]
=> [["a", "b", "c"], ["d", "e", "f"], ["g", "h", "i"]]
irb(main):002:0> row[0]
=> ["a", "b", "c"]
irb(main):003:0> row[1]
=> ["d", "e", "f"]
For your push operation you can use <<, as in:
irb(main):004:0> addition = ["j","k","l"]
=> ["j", "k", "l"]
irb(main):005:0> row << addition
=> [["a", "b", "c"], ["d", "e", "f"], ["g", "h", "i"], ["j", "k", "l"]]
···
On 7/25/07, Divya Badrinath <dbadrinath@dash.net> wrote:
I didnt get it.
I am new to Ruby.
i want it to be like this.
row = { " "a","b","c" ",
" "d","e","f" ",
" "g","h","i" "}
sow that
row[0] gives "a","b","c"
and row[1] gives "d","e","f"
say if
col is an array and
col = "a","b","c"
can i do
row.push(col)
?
--
Posted via http://www.ruby-forum.com/\.