From: Peter Szinek Date: 2006-10-20T17:28:08+09:00 Subject: Re: filling an array excepted first and last position... Josselin wrote: > ldom = 30 # variable (last day of a month...) > > # array init to 0 > @obk = [] > 1.step(ldom, 1) do |i| > @obk[i] = 0 > end You could do also @obk = Array.new(ldom) { 0 } > > I am filling an array as follows (part of a larger filling scheme) : > ---- > #fiiling the array upon another array content > # but I'd like to AVOID filling the first and last position in this > loop.... > obdays.each do |bd| > @obk[bd] = 1 > end hmm... there are maybe better ways for this, but I would try: (1..@obd.size-2).each {|i| puts @obk[i] } HTH, Peter http://www.rubyrailways.com