each() method, which iterates over the elements of the Iterable Interface.
task groovyJDK << {
String myName = "Marc"; myName.each()
{
println "${it}"
};
}
C:\> gradle –q groovyJDK
output:When you execute the above code, you should see the following output − M a r c
myName.each() {
println "${it}"
};