13 Jan
2026
13 Jan
'26
9:03 p.m.
Issue #21822 has been updated by nobu (Nobuyoshi Nakada). Is the variable `nil` if an exception is raised, even for non-local variable? By analogy with `rescue`, it feels natural for me that the variable is unchanged in that case. ---------------------------------------- Feature #21822: Expose Return Value in the ensure Block https://bugs.ruby-lang.org/issues/21822#change-116082 * Author: artemb (Artem Borodkin) * Status: Open ---------------------------------------- I'd like to propose a simple feature that allows easy access to the return value inside an ensure block. ```ruby begin # ... ensure => ret # ret is nil if an exception is raised LOGGER.debug "return value: #{ret}" end ``` -- https://bugs.ruby-lang.org/