I have a struct
struct Shots{
uint coverDrive;
uint straightDrive;
uint pull;
uint squareCut;
}
and I used a mapping
mapping(address => Shots) public BattingSkill;
Now I want to write a function which update the value of field in the struct, but the field name is dynamic, Something like this
function skillup_Batting(string memory skill_name) public view returns(Shots memory){
Shots memory skill = BattingSkill[msg.sender];
skill[skill_name] += 10;
}
Whatever skillname is provided we will update only that field and the other field remain same. Is it possible to code something like this in solidity?