Hi Yang,

Interpolated values in a GString that are closures are executed.
Have a look at the documentation which shows some examples of this:
http://groovy-lang.org/syntax.html#_special_case_of_interpolating_closure_expressions

Guillaume


On Fri, Jan 20, 2017 at 8:22 AM, Yang Yang <[email protected]> wrote:

> *Script:*
> a = {x -> println x}
> a("a${a}")
>
> *Output:*
> a
> a
>
> Why?
>



-- 
Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Developer Advocate @ Google Cloud Platform

Blog: http://glaforge.appspot.com/
Social: @glaforge <http://twitter.com/glaforge> / Google+
<https://plus.google.com/u/0/114130972232398734985/posts>

Reply via email to