Skip to content

Commit

Permalink
Remove block argument from loop (#6026)
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite authored and RX14 committed Apr 28, 2018
1 parent 9ba1ee8 commit dc2b8f0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/kernel.cr
Expand Up @@ -14,22 +14,18 @@ PROGRAM_NAME = String.new(ARGV_UNSAFE.value)
ARGV = Array.new(ARGC_UNSAFE - 1) { |i| String.new(ARGV_UNSAFE[1 + i]) }
ARGF = IO::ARGF.new(ARGV, STDIN)

# Repeatedly executes the block, passing an incremental `Int32`
# that starts with `0`.
# Repeatedly executes the block.
#
# ```
# loop do |i|
# print "#{i}) "
# loop do
# line = gets
# break unless line
# # ...
# end
# ```
def loop
i = 0
while true
yield i
i += 1
yield
end
end

Expand Down

0 comments on commit dc2b8f0

Please sign in to comment.