I understand that all of these for-each style loops are available, but I 
don't want to always go through the entire loop, sometimes I want to 
stop at some earlier condition.

I tried to do this the other night, but right now I can't find a good 
example so here it goes:

a = some_array
minValue = 999999
for(i=0; i<a.length && minValue!=0; i+=1) {
   minValue = (5000 - a[i]).abs
}


This isn't the best example.  However, there are many times like the 
loop above where I want to go through the whole thing, but if I find 
exactly what I am looking for, I want to bail out early instead of 
wasting that processing time.

Also, I sometimes may want to not actually iterate straight through, but 
browse through the array in some more complex order.
-- 
Posted via http://www.ruby-forum.com/.