views:

30

answers:

1

Is this possible and if, how?

item.foo = "moo"

def x = "foo"
item.[x] = "moo"
A: 

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
You got it....!
codedevour