groovy>> data = ["luna maya", "lady gaga", "steve jobs"]
groovy>> data.each {
groovy>> println it
groovy>> }
to iterate over a map, use:
groovy>> datas = ["lady": "gaga", "bill": "gates", "larry": "page"]
groovy>> datas.keySet.each {
groovy>> println it+": "+datas[it] // it hold the key.
groovy>> }
No comments:
Post a Comment