[前][次][番号順一覧][スレッド一覧]

ruby-changes:53170

From: knu <ko1@a...>
Date: Sat, 27 Oct 2018 16:22:43 +0900 (JST)
Subject: [ruby-changes:53170] knu:r65384 (trunk): Update the example of local variable shadowing

knu	2018-10-27 16:22:38 +0900 (Sat, 27 Oct 2018)

  New Revision: 65384

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65384

  Log:
    Update the example of local variable shadowing
    
    I came up with this snippet when we were trying to convince Matz.

  Modified files:
    trunk/NEWS
Index: NEWS
===================================================================
--- NEWS	(revision 65383)
+++ NEWS	(revision 65384)
@@ -34,7 +34,7 @@ sufficient information, see the ChangeLo https://github.com/ruby/ruby/blob/trunk/NEWS#L34
 * "shadowing outer local variable" warning was removed.  [Feature #12490]
   You can now write the following without warning.
 
-    user = User.all.find {|user| cond(user) }
+    user = users.find {|user| cond(user) }
 
 === Core classes updates (outstanding ones only)
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]