--0016e645fabc8717b704a10d78a4
Content-Type: text/plain; charset=ISO-8859-1

On Sat, Apr 16, 2011 at 1:36 PM, Josh Cheek <josh.cheek / gmail.com> wrote:

> On Sat, Apr 16, 2011 at 1:27 PM, Daniel Johnson <zaldivar1841 / gmail.com>wrote:
>
>> I am trying to translate a program I have in Java into ruby and having
>> trouble translating this for loop
>>   for(int i  ; a[i] < x;i++)
>> I tried this
>>   for i in a[i]...x
>> but it produce some errors. Any help will be appreciated. Thank you.
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>>
> numbers  1..10
> max  
>
> numbers.each do |num|
>   break unless num < max
>   puts num
> end
>


I guess, depending on your needs, you might want the index as well, in which
case

numbers.each do |num|

becomes

numbers.each_with_index do |num, index|

--0016e645fabc8717b704a10d78a4--