Thank you Paul for the help and explanation.
Couple of questions.
If I tried to use the Eval.me (stubborn me), it did not work and failed.
You mentioned that Eval.me is for full binding.
Should I infer that if I want to Eval.me, I have to use binding and set the
variables in there so they come i
I should have also mentioned that you don't need to even use evaluate if
you don't want. I'd suggest using @Field in that case:
import groovy.transform.Field
@Field zebra_test1_list = [ "zebra1", "zebra2" ]
@Field zebra_test2_list = [ "zebra3", "zebra4" ]
def zebras = (1..2).collect {
this."z
You probably want to use the binding and just normal script evaluate rather
than
Eval.me which is designed for when you don't want the full binding.
zebra_test1_list = [ 'zebra1', 'zebra2' ]
zebra_test2_list = [ 'zebra3', 'zebra4' ]
def zebras = (1..2).collect {
evaluate("zebra_${'test' + it}
Friends:
Thank you in advance for your help.
I have the following groovyscript code.
def zebra_test1_list = [ "zebra1", "zebra2" ]
def zebra_test2_list = [ "zebra3", "zebra4" ]
def data="test1"
def zebra = groovy.util.Eval.me("zebra_${data}_list")
println zebra
I get the error
groovy> def z