Skip to main content
1 of 7

when writing a simple voting smart contract, it gives an error :

//SPDX-Licence-Identifier: GNU AGPL

pragma solidity >= 0.5.0 < 0.9.0;

contract Election{ struct Candidate( string name; uint numVotes; ); struct Voter( string name; bool authorised; uint whom; bool voted;

);

address public owner;
string public electionName;

mapping (address => Voter) public voters;
Candidate [] public candidates;
uint public totalVotes;

function startElection(string memory _electionName) public{
    owner = msg.sender;
}

}

error text : Election.sol:5:21: ParserError: Expected '{' but got '(' struct Candidate( ^