Hi,

given that I don't need a return statement in groovy, do closures always return a value? Is it possible to declare a closure to have type 'void' somehow? I would like to exploit this somehow like this:

def someMethod(Closure closure){

    if (closure has no return value, or is somehow defined to be 'void'){
      closure()
    } else {
            if (closure()){
                  doSomething()
            } else {
                  doSomethingElse()
            }
    }
}

Thanks,
Felix

Reply via email to