Groovy `times` 迭代器的文档
Groovy documentation on `times` iterator
在哪里可以找到关于这种 4.times
迭代器的文档?
4.times { counter ->
tasks.register("task$counter") {
doLast {
println "I'm task number $counter"
}
}
}
tasks.named('task0') { dependsOn('task2', 'task3') }
我似乎无法在 docs 中找到它,但到处都是使用它的示例。
Groovy JDK API Documentation for Number.times(Closure closure)
:
Executes the closure this many times, starting from zero. The current index is passed to the closure each time. Example:
10.times {
println it
}
Prints the numbers 0 through 9.
Parameters:
closure
- the closure to call a number of times
Since:
1.0
这是Groovy添加到java.lang.Number
class的方法。
在哪里可以找到关于这种 4.times
迭代器的文档?
4.times { counter ->
tasks.register("task$counter") {
doLast {
println "I'm task number $counter"
}
}
}
tasks.named('task0') { dependsOn('task2', 'task3') }
我似乎无法在 docs 中找到它,但到处都是使用它的示例。
Groovy JDK API Documentation for Number.times(Closure closure)
:
Executes the closure this many times, starting from zero. The current index is passed to the closure each time. Example:
10.times { println it }
Prints the numbers 0 through 9.
Parameters:
closure
- the closure to call a number of timesSince:
1.0
这是Groovy添加到java.lang.Number
class的方法。