Tutorial by Examples

How can I print hello world 5 times? 5.times{ println "hello world" }
each and eachWithIndex are methods to iterate over collections. each have it(default iterator) and eachWithIndex have it,index(default iterator, default index). We can also change the default iterator/index. Please see below examples. def list = [1,2,5,7] list.each{ println it } list.ea...

Page 1 of 1