I'm facing a problem with the function return type in solidity. Here is my code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
contract Birth {
mapping(uint256 => bool) public isValidBirthCerti;
function birthCertiGenerator(
string memory _Name
) public returns (uint256) {
uint256 birthCerti = uint256(
keccak256(
abi.encodePacked(
_Name
)
)
) % 100000000000000000;
isValidBirthCerti[birthCerti] = true; //if I remove this ,then I get the returned value.
return birthCerti;
}
}
In the birthCertiGenerator function which returns a uint256 type value, is not returning the value if I use isValidBirthCerti[birthCerti] = true;
this line.
Is there anything wrong ? Or Am I missing something here?