0

Is this possible and if, how?

item.foo = "moo"

def x = "foo"
item.[x] = "moo"
Christopher Klewes
  • 11,181
  • 18
  • 74
  • 102

1 Answers1

0

I'm not sure I get your question, but...

def item = {
    def foo
}
def x = "foo"
item[x] = "moo"

assert item[x] == "moo"
assert item.foo == "moo"
Philippe
  • 6,703
  • 3
  • 30
  • 50