From: Kaldrenon Date: 2007-06-22T06:05:10+09:00 Subject: Re: Two Problems From a Newbie On Jun 21, 1:48 am, danielj wrote: > def mtdarry > > 10.times do |num| > > square = num * num > > return num, square if num > 5 > Don't know if this pertains to your problem, since you haven't said explicitly what you're trying to do, but it looks like you want the square of all numbers x where 5 < x < 10? If that's the case, there are two problems. One, as was mentioned, is that .times starts at 0. The other is that the keyword "return" will exit the function. It will pass num, square to the source of the function call, and then it the function is done being evaluated. You can solve this by either building an array of value/square pairs or moving the iteration up a level, so that the method gets called 10 times with a new value each time.