Below is how I do the record into the mapping array. How can I create a clear|removeall function that clears or reset all the records back to default which is empty?
address payable[] public players;
mapping(address => uint256[]) playerTicket;
function playersRecord() public view returns(uint256[] memory){
return playerTicket[msg.sender];
}
I managed with the below function to clear one by one but not sure how to clear all
function remove(address _addr) public {
// Reset the value to the default value.
delete playerTicket[_addr];
}