if i define a groovy variable
def x = "anish$"
it will throw me error, the fix is
def x = "anish\$"
apart form “$” what are the blacklist characters that needs to be backslash,Is there a Groovy reference that lists the reserved characters. Most “language specifications” mention these details, but I don’t see it in the Groovy language spec (many “TODO” comments).
Just use single quotes:
If this isn’t possible, the only thing that’s going to cause you problems is
$, as that is the templating char used byGString(see the GString section on this page — about half way down)Obviously, the backslash char needs escaping as well, ie: