I came across below example from the Solidity Documentation
and have similar code in my project and want to set default value
to key parameter if the key is not passed from the caller
pragma solidity ^0.4.0;
contract C {
function f(uint key, uint value) public {
// ...
}
function g() public {
// named arguments
f({value: 2, key: 3});
}
}
My questions are -
- Do Solidity language provides
default parameters
? - How to achieve the same if default parameters are not allowed then?
Appreciate the help?