Hello Bulat,

Tuesday, October 08, 2002, 2:32:33 PM, you wrote:

BZ>   to mark vars as local to block we can use any of methods above. but
BZ>   imho it is better to explicitly declare vars imported from outer
BZ>   blocks:

BZ>   a = 1
BZ>   {
BZ>     a = 2  # ruby prints warning - outer var used without explicit import
BZ>     {
BZ>       import a
BZ>       a = 3      # OK - changing value of imported variable

and, of course:

def collect(array)
  method = proc { |x|
    import a
    a << x
  }
  a = []
  array.map {|elem| method.call(elem)}
  a
end

i.e. "a=[]" may be placed AFTER using "a" in inner block


-- 
Best regards,
 Bulat                            mailto:bulatz / integ.ru