Builtockchain
Builtockchain

Reputation: 39

Solidity ParserError: Expected identifier but got '(' constuctor() public { ^

pragma solidity ^0.6.0;

contract MyContract {
// Mappings
mapping(uint => string) public names;

constuctor() public {
    names[1] = "Adam";
    names[2] = "Bruce";
    names[3] = "Carl";
}

}

I tried compiling this code on remix.ethereum.org and I got the following error:

Solidity ParserError: Expected identifier but got '(' constuctor() public { ^

How can I go about solving this issue? Could anyone please help?

Upvotes: 0

Views: 2383

Answers (1)

Emmanuel Collin
Emmanuel Collin

Reputation: 2606

You have a typo in your constructor declaration :

constructor() public {

instead of

constuctor() public {

"r" is missing

Upvotes: 2

Related Questions