From: Paul Lutus Date: 2006-09-11T03:50:41+09:00 Subject: Re: Matrix v.srikrishnan@gmail.com wrote: > Hi all, > a) Is there a way to create a non-square matrix in ruby? Another poster has answered this one. > b) How does one set any arbitrary element of an array? Like this: ------------------------------------------- #! /usr/bin/ruby size = 9 # create, preset value array = Array.new(size) { Array.new(size) {"."} } # change one value array[4][4] = '*' # show it array.each do |b| b.each do |i| print b[i] end puts "" end Output: ......... ......... ......... ......... ....*.... ......... ......... ......... ......... -- Paul Lutus http://www.arachnoid.com