From: Michael Linfield Date: 2009-12-01T06:19:09+09:00 Subject: Re: have a problem with the loops and variable > My last code : > ----------------- > q = 1 > w = 2 > while q < w > s[q] = 1 > puts s[q] > q += 1 > end > ----------------- > > Why does not work ? You should be declaring s as an array: s[] >> s = [] => [] >> q = 1 => 1 >> w = 2 => 2 >> while q < w .. s[q] = 1 .. puts s[q] .. q += 1 .. end 1 => nil >> -- Posted via http://www.ruby-forum.com/.