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?
You have a typo in your constructor declaration:
constructor() public {
instead of
constuctor() public {
"r" is missing
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.