From: Christopher Dicely Date: 2011-04-17T05:30:03+09:00 Subject: Re: For loops trouble On Sat, Apr 16, 2011 at 11:27 AM, Daniel Johnson wrote: > I am trying to translate a program I have in Java into ruby and having > trouble translating this for loop >   for(int i = 0; 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. A simple literal translation goes from this: for (int i=0; a[i] < x; i++) { ... } to this Ruby: i = 0 while a[i] < x ... i += 1 end That Ruby is almost certainly not the best way to translate the Java loop, but the best way really depends on what you are doing in the loop.