I'm just newbie in Gradle and while I was reading the Gradle manual I came across the follwoing code example:
task count << {
4.times { print "$it " }
}
It prints 1 2 3 4. Why? What is $it and why if we replaced $it to "a" we would receive
a a a a
Moreover
task count << {
print "$it "
print "$it "
print "$it "
print "$it "
}
gives the output task ':count' task ':count' task ':count' task ':count'
From http://groovy-lang.org/closures.html#implicit-it
From http://grails.asia/groovy-times-loop-examples
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With