Thank you very much for your answer. I did not mention that I am not using Rails in this case.
But the problem disappeared this morning - somehow. :) On 21 Apr., 02:35, IAmNan <[email protected]> wrote: > Oh, here's with the new notation you're using. Sorry about that. > > self.outer = [] > func = -> n { self.outer << n } > func[1] > > > > > > > > On Friday, April 20, 2012 2:32:08 PM UTC-10, IAmNan wrote: > > > Are you doing this in the model, and is outer a member variable? If so, > > did you forget to use self on it? > > > self.outer = [] > > func = lambda { |n| self.outer << n } > > func[1] > > > On Friday, April 20, 2012 12:37:14 PM UTC-10, ms wrote: > > >> Hey, > > >> thank you for reading this post. > > >> Why won't this work? > > >> outer = [] > >> func = ->(n) { outer << n } > >> func[1] > > >> => outer stays empty. Why that? Since outer is readable in the lambda > >> function it should be changeable as it is the same instance of the > >> array. I am a bit confused. > > >> Thanks you very much for your answers. > >> ms -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

