def processList(list, closure) {
list.each { item ->
closure.call(item)
}
}
def printItem = { item ->
println "Processing item: ${item}"
}
def list = [1, 2, 3, 4, 5]
processList(list, printItem)
def processList(list, closure) {
list.each { item ->
closure.call(item)
}
}
def printItem = { item ->
println "Processing item: ${item}"
}
def list = [1, 2, 3, 4, 5]
processList(list, printItem)