Reputation: 347
I am Newbie to Groovy.I am using java 7 and groovy 2.2.2 version. No problem with Environment variables settings.
I am trying the following in groovy shell :
hc = { println ""HI $it"" }
c=1..5
c.each hc
When I am executing third statement(c.each hc), it is throwing :
unknown property $it
I don't understand What will be the problem ????
Upvotes: 0
Views: 889
Reputation: 97150
Try like this:
hc = { println "HI $it" }
c=1..5
c.each hc
Don't know how Groovy will try to parse it exactly, but double double-quotes ""
have no meaning in Groovy. When using double quotes, either single "
or triple """
will work.
Upvotes: 3