If you are trying to use Groovy Multiple Assignment, you can do something like this:
def func1 = {
['jeff', 'betsy', 'jake', 'zack']
}
def (dad, mom, son1, son2) = func1()
assert 'jeff' == dad
assert 'jake' == son1
assert 'zack' == son2
assert 'betsy' == mom
In your example, you used square brackets instead of parens, which will not work.
source
share