Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Groovy have object destructuring like Javascript?

Does Groovy have object destructuring with multiple assignments like Javascript:

let options = {
  title: "Menu",
  width: 100,
  height: 200
};

let {title, width, height} = options;

alert(title);  // Menu
alert(width);  // 100
alert(height); // 200
like image 769
dilvan Avatar asked Oct 17 '19 12:10

dilvan


1 Answers

Groovy doesn't have JavaScript's object destructuring... It only has index based destructuring

https://groovy-lang.org/semantics.html#_object_destructuring_with_multiple_assignment

like image 132
tim_yates Avatar answered Sep 28 '22 20:09

tim_yates