From: cbare Date: 2008-05-22T14:00:04+09:00 Subject: Why does returning from a block cause a LocalJumpError Hi Ruby gurus, I'm hoping someone can set me straight about something. Take the following lines of Ruby and output from the interpreter: [1,2,3].map {|a| a*a} >> [1,4,9] [4,5,6].map {|a| return a*a} >> LocalJumpError: unexpected return I'm trying to fit Ruby's code blocks in with the concept of anonymous functions that's in my brain from languages like Scheme. It seems that a code block must be something a little different, because returning from an anonymous function should be a fine thing to do. Does a code block not create an environment for local variables on the stack? What is a LocalJump anyway? I'm sure this is addressed elsewhere, but thanks for any clues or pointers, -chris