I am new to solidity. I have a Person struct and mapping:
struct Person{
uint age;
string gender;
}
Person[] players; // holds the 24 players
mapping (string => Person) selectedPair;
I have to chose a boy and a girl.
function choosePair() public {
// save the chosen person in selectedPair if its the correct gender
for (uint i=0; i<players.length; i++) {
Person storage chosenOne = players[pseudoRandom(0,23)];
if(selectedPair[chosenOne.gender] != 0){ //error!
// I want to know if there is a "girl" already in the selectedPair mapping.
}
}
I get the error:
TypeError: Operator != not compatible with types struct