From: "Chris R." Date: 2011-01-29T00:26:57+09:00 Subject: Each Array Method Skipping first Array position Could someone tell me why in the following code, when it iterates on the array 'arraya' it skips the first position? It is strange because immediatley before each is called on arraya, I call inspect and you can clearly see the first value is 1800, but the first value out put is 1801. #code start startyear = nil endyear = nil arraya = [] currentyearis = false puts 'What year should I start with?' startyear = gets.chomp puts 'What year should I end with?' endyear = gets.chomp #assign years including and between start/endyear into array arraya = (startyear...endyear).to_a #iterate on array puts arraya.inspect arraya.each do |currentyear| if currentyear.to_i % 4 == 0 if currentyear.to_i % 100 == 0 puts currentyear.inspect puts('The Year ' + currentyear + ' is not a leap year.') if currentyear.to_i % 400 == 0 else puts('The Year ' + currentyear + ' is a leap year.') end else puts('The Year ' + currentyear + ' is not a leap year') end end #code end -- Posted via http://www.ruby-forum.com/.