0

I know that you can't define optional parameters in solidity, but what are the best patterns to imitate it? The only way I know it is function overloading but sometimes it doesn't fit.

AGJoYy
  • 416
  • 3
  • 12

1 Answers1

1

You can use unnamed parameters (function parameters without any name) in Solidity. Unnamed parameters can be useful if you have a function that overrides another function (as in inheritance), but you only need certain parameters from that function. They are also often used for return parameters.

See:

In Solidity how to use unnamed function parameters?

Yongjian P.
  • 4,170
  • 1
  • 3
  • 10