Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git] / bench / shootout / message.jruby-2.jruby
blob76c37bcd13135b2c3deca551ff6e508fe3d52420
1 #!/usr/bin/env ruby
3 # Gonzalo Garramuno -- Dec.31 2006
6 def coroutine(n)
7 if n > 1
8 coroutine(n-1) { |x| yield x + 1 }
9 else
10 yield 1 while true
11 end
12 end
14 iter = 0
15 last = ARGV[0].to_i
16 count = 0
18 coroutine( 500 ) { |x|
19 break if iter >= last
20 count += x
21 iter += 1
24 puts count