One of the Groovy’s sexy feature is that we can assign list entries to multiple variables. One of the scenario I faced that my method returns a list and I have to assign that list entries to different variables As:

def myMethod(){
['Abdullah', 'Mohd']

def (fName,lName) = myMethod()

We can check by asserting these assignment as:

assert fName = 'Abdullah'
assert lName = 'Mohd'

And it is obvious that if method returns more values than variables than extra entries will be ignored. And if number of variables are more than the list values than extra variable will not be set.