From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2003-02-09T14:51:23+09:00 Subject: 'static' variables in a proc? Is there a way to get a variable in a proc that maintains it's value between different calls of the proc? I tried using an instance variable: p = proc { unless defined? @a @a = 1 end puts @a @a+=1 } # irb(main):024:0> p.call true NameError: undefined method `+' for true from (irb):22 from (irb):18:in `call' from (irb):24 I'm not sure why @a became true... Then I tried: p = proc{ unless defined? a a = 1 end puts a a += 1 } ....and of course all I ever get out of it is 1, but at least a doesn't become 'true'. Phil