From 48771a357cbfb4ce86764a420997c0df5f5ee5b2 Mon Sep 17 00:00:00 2001
From: "Yukihiro \"Matz\" Matsumoto" <matz@ruby-lang.org>
Date: Wed, 21 Oct 2015 21:47:43 +0900
Subject: [PATCH] loop() to return StopIteration#result; [ruby-bugs#11498]

---
 mrblib/kernel.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mrblib/kernel.rb b/mrblib/kernel.rb
index 38af3b310..550ae8172 100644
--- a/mrblib/kernel.rb
+++ b/mrblib/kernel.rb
@@ -30,8 +30,8 @@ module Kernel
     while true
       yield
     end
-  rescue StopIteration
-    nil
+  rescue StopIteration => e
+    e.result
   end
 
   # 11.4.4 Step c)
-- 
2.26.2