summaryrefslogtreecommitdiffhomepage
path: root/mrblib/array.rb
diff options
context:
space:
mode:
authorYukihiro Matz Matsumoto <[email protected]>2012-12-19 20:41:41 +0900
committerYukihiro Matz Matsumoto <[email protected]>2012-12-19 20:41:41 +0900
commit55870e4b82825b7b082d6ec1076dcb49942ac777 (patch)
tree53c9584fc3ae85099f3bdfe63f9cddb63345f0c1 /mrblib/array.rb
parent1184efe62b4fe537df6941fde43cdd56b82490bd (diff)
downloadmruby-55870e4b82825b7b082d6ec1076dcb49942ac777.tar.gz
mruby-55870e4b82825b7b082d6ec1076dcb49942ac777.zip
small refactoring for Array#each
Diffstat (limited to 'mrblib/array.rb')
-rw-r--r--mrblib/array.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/mrblib/array.rb b/mrblib/array.rb
index 3dc6b57d1..3c4e2dd76 100644
--- a/mrblib/array.rb
+++ b/mrblib/array.rb
@@ -11,8 +11,9 @@ class Array
# ISO 15.2.12.5.10
def each(&block)
idx, length = -1, self.length-1
- block.call(self[idx += 1]) while(idx < length)
-
+ while(idx < length)
+ block.call(self[idx += 1])
+ end
self
end