Groovy swap variables like ruby

What is the best way to replace with a variable in Groovy?

Is it possible to do something like Ruby?

x, y = y, x

+7
source share
1 answer

Just use parentheses for multiple assignment

(x,y) = [ y, x ] 
+16
source

All Articles