Groovy 中的嵌套“each”循环
Nested `each` loops in Groovy
需要有关 groovy 中嵌套循环语法的指导。如何使用迭代器在此处打印([=14= 的值],b.name 的值)的值?
List a
a.each {
print(it.name)
List b = something
b.each {
print(value of a.name, value of b.name)
}
}
List a
a.each { x ->
println(x.name)
List b = something
b.each { y ->
println(x.name + y.name)
}
}
需要有关 groovy 中嵌套循环语法的指导。如何使用迭代器在此处打印([=14= 的值],b.name 的值)的值?
List a
a.each {
print(it.name)
List b = something
b.each {
print(value of a.name, value of b.name)
}
}
List a
a.each { x ->
println(x.name)
List b = something
b.each { y ->
println(x.name + y.name)
}
}