+ 1
Ruby closures?
Hey! Need some help in understanding closures in Ruby. How do i access a variable from outside the method without yeilding it to a lambda? I just don't get it. Just returning its value doesn't seem to work.
2 Antworten
+ 1
well, here's the answer: useanother variable assigning the result of the method to it. no closures needed. and about that closures: a closure is a proc or a lambda that remembers the lexical scope it was defined in even if it's called from outside that scope and also it can be passed around as an argument to other metods. have fun!
+ 1
come on people!)