Hi, can someone please tell me why this code does not work? It gives the error message…function, variable, struct or declaration expected. At line 5…public playerCount = 0;
Thanks
pragma solidity >=0.7.0 <0.9.0;
contract FindPlayer {
public playerCount = 0; //counts the number of books in array//
mapping(address => Player) public players;
enum level {Novice, Intermediate, Advanced}
struct Player {
address playerAddress;
level playerLevel;
string firstName;
string lastName;
}
function AddPlayer(string memory firstName, string memory lastName) public {
players[msg.sender] = player(msg.sender, level.Novice firstName, lastName);
playerCount += 1; //adds the number of books to array in increments of 1//
}
function getPlayerAddress(address playerAddress) public view returns(level){
return players[playerAddress].playerLevel;
}
}