Actions
Bug #19779
open`eval "return"` at top level raises `LocalJumpError`
Description
Wondering whether it's intentional behaviour. It seems it's the only difference I've noticed between calling return
with and without eval
:
ruby -e 'return'
ruby -e 'eval "return"'
(eval):1:in `<main>': unexpected return (LocalJumpError)
from -e:1:in `eval'
from -e:1:in `<main>'
Updated by matz (Yukihiro Matsumoto) 3 months ago
Since we allow top-level return (from 2.4), it is nice to allow this too. But to be frank, it is low priority.
Matz.
Updated by jeremyevans0 (Jeremy Evans) about 1 month ago
I submitted a pull request to fix this: https://github.com/ruby/ruby/pull/8766
Actions
Like0
Like0Like0Like1