2.times ->(_){ a += 1 }

boron e$B$G$N<:GT$NCf$K!“0J2<$N$b$N$,$”$j$^$9!#e(B

  1. Error:
    test_lambda_as_iterator(TestLambdaParameters):
    ArgumentError: wrong number of arguments (1 for 0)
    /home/akr/chkbuild/tmp/build/ruby-trunk/ruby/test/ruby/test_lambda.rb:50:in
    Integer#times' /home/akr/chkbuild/tmp/build/ruby-trunk/ruby/test/ruby/test_lambda.rb:50:intest_lambda_as_iterator’

e$B$3$N%F%9%H$O0J2<$N$b$N$G$9$,!"$3$N$h$&$Je(B -> e$B$C$F!"$J$/$J$C$?e(B
e$B$s$8$c$J$+$C$?$G$7$?$C$1e(B?

def test_lambda_as_iterator
a = 0
2.times ->(_){ a += 1 }
assert_equal(a, 2)
end

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:28958] 2.times ->(_){ a += 1 }”
on Wed, 5 Jul 2006 00:42:08 +0900, Tanaka A. [email protected]
writes:

|boron e$B$G$N<:GT$NCf$K!“0J2<$N$b$N$,$”$j$^$9!#e(B

| 21) Error:
|test_lambda_as_iterator(TestLambdaParameters):

|e$B$3$N%F%9%H$O0J2<$N$b$N$G$9$,!"$3$N$h$&$Je(B -> e$B$C$F!"$J$/$J$C$?e(B
|e$B$s$8$c$J$+$C$?$G$7$?$C$1e(B?

e$B$J$/$J$j$^$7$?!#%F%9%H:o$i$J$-$c$G$9$M!#e(B

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs