From: "Mehr, Assaph (Assaph)" Date: 2004-08-19T12:57:56+09:00 Subject: Re: proc return statement > @@mappings.each{ |hsh| > begin > if( hsh['type'] == c['type'] ) then > eval( "comp=#{hsh['template']}" ) > hsh.each_key{ |key| > m = proc { @@ignore.each{ |i| return true if( key == i ) } > }.call Should be: proc{break true if... }.call 'return' returns from the encompassing method. 'break' return from the proc. > puts m; > } > has_mapping = true; > end > rescue; raise "Unable to evaluate passed in expression: > #{hsh['template']}"; end > break if( has_mapping ); } > > It is at the line: m = proc { @@ignore.each{ |i| return true if( key > == i ) } }.call > that I am having the problem. I want "m" to be true, but instead it > leaves the calling function. > > I have modified the line to be: > > m = nil; > proc { @@ignore.each{ |i| m=true if( key == i ) } }.call > > but I was just wondering if I could return a value w/o having to leave > the outer function. > > Zach > >