Solidity allows for unnamed function params, how to use them?

contract C {

 // omitted parameters
 function func(uint k, uint ) returns(uint) {
    return k;

  • 1
    +1 for bringing up an interesting topic unused method parameter, for return parameter see my answer. Jul 4 '16 at 18:53
  • Frankly I suspect it is only a sideeffect for creating the unnamed return parameter. It was easier to say in this BNF both are a parameter and I allow also input parameter but they will go to dev/null... If not I will be happy to know a new feature... Jul 4 '16 at 18:57

I could answer the returns parameter anonymity.It takes a return statement to return some value from the function for not having a parameter name.

Whereas having a named parameter in the returns, we don't need a return statement.Whatever value is assigned to the named parameter in the return argument would be returned at the end of the function execution automatically.

function func(uint k, uint ) returns(uint myValue) {

404 is returned automatically without even having a return statement. I hope it helps partially


Increases readability.

If your logic doesn't require some of the parameters, omit naming those parameters to make it obvious that your logic doesn't depend on them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.