2 ms·
Nested String Interpolation in Groovy
- DecoPerson 1y agoThe syntax highlighter not understanding GStrings (heh) doesn't help here. It's obvious once you release that whatever is inside a GString is simply an expression. def expr = foo."${baz}" println("Bar value: ${expr}") This makes sense. But this, or any of the other variations... def expr = foo." + baz + " println("Bar value: ${expr}") ...does not make sense. If the syntax highlighter understood GStrings, then this would be obvious. Let S be string colour and _ be non-string colour: println("Bar value: ${foo."${baz}"}") ________SSSSSSSSSSSSSS____SSS___SSSS_