Skip to content

Instantly share code, notes, and snippets.

@ishults
Last active December 16, 2015 20:09
Show Gist options
  • Save ishults/a9915bd20b3fd2988100 to your computer and use it in GitHub Desktop.
Save ishults/a9915bd20b3fd2988100 to your computer and use it in GitHub Desktop.
Multiple assignment using .with()
Dog dog = new Dog()
//...
dog.with {
(name, age, color) = ['Rex', 2, Color.BLACK]
}
assert 'Rex' == dog.name
assert 2 == dog.age
assert Color.BLACK == dog.color
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment