title: Groovy 'def' keyword and scope problem in Eclipse
body: <p>I'm following a groovy tutorial and there is a code like this: </p>
  
  <pre><code>def fruit = ["apple", "orange" , "pear"]    //list
  def likeIt = { String fruit -&gt; println "I like " + fruit + "s" }    //closure
  fruit.each(likeIt)
  </code></pre>
  
  <p>Eclipse reports an error at closure definition line:</p>
  
  <blockquote>
    <p>Line breakpoint:SimpleClosuresTest
    [line: 27] The current scope already
    contains a variable of the name fruit 
    @ line 27, column 14.</p>
  </blockquote>
  
  <p>If i omit 'def' from 'def fruit' Eclipse doesn't complaint and code runs fine.</p>
  
  <p>Could someone explain what is going on with the scopes in both cases?</p>
  
  <p>Thanks.</p>