title: Groovy - Closures and bind, why this code doesn't work?
body: <p>I think this is a newbie question but why it fails on the last assertion?
  I was thinking that the closure binds the value on it, so changing it from the closure will change the value outside the closure.</p>
  
  <pre><code>def value = 5
  
  def foo(n){
  
    return {
  
      ++n
  
    }
  }
  
  def test = foo(value)
  
  assert test() == 6
  assert test() == 7
  
  assert value == 7
  </code></pre>
  
  <p>Thanks for help.</p>