English 中文(简体)
休息日
原标题:with qualifying of any of the return sattement do the loop break groovy

居留权是否在规定返回声明时终止? 即使在价值无效的情况下也如此?

问题回答

你的问题过于模糊,难以以任何确定性回答。 然而,我是否要危害一个gues子?

如果是,答案是:没有,返回(或休息)不会终止居留。 这样做的唯一途径是将一个例外列入:

try{
    (1..10).each{ n->
        println n
        if (n == 5) throw new Exception()
       }
}        
catch(Exception){}

但是,这完全是荒谬的。 a. 代替休息。

<>也可查阅:https://stackoverflow.com/questions/765/560how-does-one-return- from-a-groovy-closure-and-up-its-execution>>。

如果我不打上标记,也许你会把某些法典引出你们的话题?





相关问题
Groovy - how to exit each loop?

I m new to Grails/Groovy and am trying to find a node in a an xml file; I ve figured out how to iterate over all of them, but I want to exit the loop when the target node is found. I ve read that ...

Eclipse Spring Builder set properties with Groovy beans

I typically use groovy to construct simple bean but the Spring IDE plugin to eclipse fails to build when I try to set a property that is generated by groovy without an explicit setter. For example, ...

How can I get this snippet to work?

I d like to port a little piece of code from Ruby to Groovy, and I m stuck at this: def given(array,closure) { closure.delegate = array closure() } given([1,2,3,4]) { findAll { it > 4} ...

Changing the value in a map in Groovy

This is about a very basic program I m writing in Groovy. I have defined a map inside a method: def addItem() { print("Enter the item name: ") def itemName = reader.readLine() print(...

Is functional Clojure or imperative Groovy more readable?

OK, no cheating now. No, really, take a minute or two and try this out. What does "positions" do? Edit: simplified according to cgrand s suggestion. (defn redux [[current next] flag] [(if flag ...

热门标签