0

ParserError: Expected identifier but got 'public', I am new to solidity using remix to compile also tried different version.

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
struct list{
    string Pan;
    uint age;
    address Address;
    bool Enrolled;
    bool voted;
} 
struct candidate_list{
    string Name;
    address Address;
    uint id;
    bool listed;
}
address election_officer;
string public decimal="0";// getting error here
uint public totalSupply;
address public founder;

1 Answer 1

2

take a look at the Structure of a Contract in the doc

you are missing the contract part, check the following code:

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;

contract ContractName {
  struct list {
    string Pan;
    uint256 age;
    address Address;
    bool Enrolled;
    bool voted;
  }
  struct candidate_list {
    string Name;
    address Address;
    uint256 id;
    bool listed;
  }
  address election_officer;
  string public decimal = '0'; // getting error here
  uint256 public totalSupply;
  address public founder;
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.