From: "matz (Yukihiro Matsumoto) via ruby-core" Date: 2026-02-12T08:13:28+00:00 Subject: [ruby-core:124785] [Ruby Feature#21822] Expose Return Value in the ensure Block Issue #21822 has been updated by matz (Yukihiro Matsumoto). I don't think it's not worth for the new syntax, where you can do similar thing with: ``` begin ret = begin # .... end ensure LOGGER.debug "return value: #{ret}" end ``` Matz. ---------------------------------------- Feature #21822: Expose Return Value in the ensure Block https://bugs.ruby-lang.org/issues/21822#change-116396 * 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/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/