Thank you Jeremy! I changed:

if year1.to_i % 4 == 0
  leapyear = year1.to_i + 4
  puts leapyear

 to:

if year1.to_i % 4 == 0
 year1 = year1.to_i + 4
  puts year1


and that helped a great deal. I see now that I was not evaluating the 
incrementation.

You guys have been a great help!

Thanks again!


Jeremy Bopp wrote:
> On 10/01/2010 01:29 PM, Mica Koizumi wrote:
>>> if year1 is a leapyear then print year1 + 4
>>
>> Shouldn't that prevent 1992 from being printed?
> 
> That while condition is only evaluated at the beginning of each pass
> through the loop.  The first pass (where 1987 <= 1900) adds 1 to year1
> making it 1988.  The second pass (where 1988 <= 1990) sets *leapyear* to
> year1 + 4 (1988 + 4 = 1992) and then prints *leapyear* which is now
> 1992; however, it does not modify the value of year1.  From hear on, the
> loop continues printing 1992 infinitely because year1 is never updated
> again and will always be 1988 which is less than 1990.
> 
> -Jeremy

-- 
Posted via http://www.ruby-forum.com/.