From: "DaShiell, Jude T. CIV NAVAIR 1490, 1, 26" Date: 2010-10-02T04:01:32+09:00 Subject: Re: New to Ruby, Looking for Help With Basic Program Probably because chomp.gets will work better. The gets.chomp has has chomp getting first crack at info and then chomp passes it along to gets. -----Original Message----- From: monkeymica@yahoo.com [mailto:monkeymica@yahoo.com] Sent: Friday, October 01, 2010 14:05 To: ruby-talk ML Subject: New to Ruby, Looking for Help With Basic Program I am teaching myself Ruby and am trying to figure out why this program is doing what it is doing: puts 'Year 1?' year1 = gets.chomp puts 'Year 2?' year2 = gets.chomp while (year1.to_i <= year2.to_i) if year1.to_i % 4 == 0 leapyear = year1.to_i + 4 puts leapyear end if year1.to_i % 4 != 0 year1 = year1.to_i + 1 puts year1 end end When year1 = 1987 and year2 = 1990, why is it printing out 1992? I am expecting 1988. Thanks in advance... -- Posted via http://www.ruby-forum.com/.