From: MenTaLguY Date: 2007-03-01T04:54:57+09:00 Subject: Re: Ruby's "case" doesn't behave like a normal switch On Thu, 1 Mar 2007 04:36:39 +0900, Pit Capitain wrote: >> catch(:redo) do >> case a >> when 1 >> print '1' >> a = 2 >> redo >> when 2 >> puts 'and 2' >> end >> end > I didn't know the "catch(:redo)". Is this documented somewhere? It doesn't have to be catch(:redo) specifically, and in fact its use may be misleading -- here, catch is simply being used to introduce an iteration context. For example, this works just as well: def foo ; yield ; end a = 1 foo do case a when 1 print '1' a = 2 redo when 2 puts 'and 2' end end -mental