GGarramuno wrote:

>catch(:arg) do
>         while $stdin.getc
>           begin
>               p "A"
>               while 1
>                     p "B"
>                     throw :arg if 1
>               end
>           ensure
>               #do a lot of stuff here
>               p "ensure"
>           end
>        end
>end
>
>and I still exit the loop right away.  I want to be able to do a
>"next" on the outer loop from within the inner loop and the
>throw/catch mechanism seems to be only a solution to breaking out of
>loops, not iterating to the next step (while evaluating the
>condition).
>I'm sure I am missing some obvious way of doing this.
>
>  
>

I think you just need to put the catch(:arg) inside the outer loop, like 
this:

  while $stdin.getc
    catch(:arg) do
      begin
        p "A"
        while true
          p "B"
          throw :arg if true
        end
      ensure
        #do a lot of stuff here
        p "ensure"
      end
    end
  end

Another thing to watch for -- avoid treating '1' as true.  Although '1' 
is true, so is '0', in Ruby.  Use the 'true' and 'false' literals, instead.

-- 
Jamis Buck
jgb3 / email.byu.edu

ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'