From: Brian Candler Date: 2011-04-19T21:24:55+09:00 Subject: Re: anonymous closures with Proc,new, lambda and -> Stu wrote in post #993715: >> c = lambda { |;init| init = 200; ...etc... }.call >> >> >> > What does the semicolon tell the interpreter here? It's a block-local variable. You can think of it as a block argument which is never passed by the caller, so always gets nil. Compare: c = lambda { |init| ... } # init is local, value is passed c = lambda { |init;x,y| ... } # init is local, value is passed; # x and y are local, no value passed So given: init = 123 c = lambda { |;init| init = 456; ... } puts init # 123 then the 'init' inside the lambda is always a different 'init' to the one outside. Any arguments which the lambda took would come before the semicolon, but there are zero in this case. For more info google "ruby block local variables" IMO it ranks with '->' as an ugly and unnecessary bit of 1.9 syntax, but tastes vary. See what you think of: c = ->(;init) { init=100; ->{init += 1} }.call Regards, Brian. -- Posted via http://www.ruby-forum.com/.