1
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;

contract C {
    // omitted name for parameter
    function func(uint k, uint) public pure returns(uint) {
        return k;
    }
}

The code above has two parameters: k and another unnamed parameter.

What is the point of having an unnamed parameter?

One use case I can think of is function overriding but what else can it be used for? Is it okay if we won't pass unnamed parameter?

1 Answer 1

0

I think you got it. Overriding, and then sometimes you'll see this kind of thing if you're trying to subscribe to a standard (e.g. ERC721) and you actually don't need that variable for how you're handling the implementation.

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.