From: Marcelo Date: 2009-05-06T05:07:16+09:00 Subject: Re: Min max program On Tue, May 5, 2009 at 13:46, Taylor Lodge wrote: > After more fiddling i fixed the error (needed another end for the if > statement DUH) and it works but I can't figure out sum if you do sum += > nums it gives an error. It's easier for people to help you if you show the error you are seeing. In this particular case, since you are not initializing sum, the first time the program encounters: sum += num you are effectively doing: sum = nil + num Something like this: > nums = Array.new(8) { rand(10000) } > max = 0 > min = 10001 sum = 0 Also, in this case it's irrelevant, but you might wish to initialize min and max like this instead: min = max = nums[0] Marcelo