I have a method as follows:
void display(def a = null, def b = null) {
// user provides either value for a, or b
// if he gives value for a, it will be used
// if he gives value for b, it will be used
// not supposed to provide values for both a and b
}
My question is, how is user supposed to provide value for b?
If I use
display(b = 20)
It assigns 20 to a
, which I don't want.
Is the only way to accomplish this is to call as follows?
display(null, 20)