Default parameters can reference other parameters.
This little snippet of Groovy:
def f(x, y = x) {
println "x=$x, y=$y"
}
f('hello', 'world')
f('hi')
Gives:
x=hello, y=world x=hi, y=hi
Default parameters can reference other parameters.
This little snippet of Groovy:
def f(x, y = x) {
println "x=$x, y=$y"
}
f('hello', 'world')
f('hi')
Gives:
x=hello, y=world x=hi, y=hi