From: sur max Date: 2007-02-21T05:58:44+09:00 Subject: Re: exit a block ------=_Part_48397_2065490.1172005121051 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline If it can be compromised to have another variable, its more like the ruby way ... lets say myarray=[1,2,3,666,7] myarray.each_with_index{|a,i| index = i and break if a == 666 } index # => 3 On 2/20/07, Austin Ziegler wrote: > > On 2/20/07, Jim Bob wrote: > > Thanks for your help, sometimes best just to program an old fashion for > > loop ;) > > ...except that: > > for a in b > return a if a > 5 > end > > ...is the same as: > > b.each { |a| return a if a > 5 } > > (Except in matters of scope.) > > -austin > -- > Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ > * austin@halostatue.ca * http://www.halostatue.ca/feed/ > * austin@zieglers.ca > > -- sur http://expressica.com ------=_Part_48397_2065490.1172005121051--