mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
small refactoring for Array#each
This commit is contained in:
+3
-2
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user