In Groovy we can assign default values to parameters in a method, like this:
def say(msg = 'Hello', name = 'world') {
"$msg $name!"
}
However, what's the simplest way to assign default values for variable assignments, when they are not from the method parameters, like environment variables or JMeter variables, as in Can I override User Variables in Test Fragment?
Is this the only way?
def mySession = System.getenv("SESSIONNAME") ? System.getenv("SESSIONNAME") : "Session Default"
Is there any other ways, like in NodeJS syntax:
def mySession = System.getenv("SESSIONNAME") || "Dfault"?