1
CompileError: /C/Users/Asusupernova/Downloads/TrufflePart2/contracts/Hello.sol:8:30: ParserError: Expected ',' but got 'memory'
    constructor(string _name memory) public {
                             ^----^
// SPDX-License-Identifier: MIT
pragma solidity^0.5.16;

contract HelloWorld {
    string private name;

    constructor(string _name memory) public {
      name = _name;
    }

    function getName() public view returns (string memory) {
      return name;
    }

    function setName(string _name) public {
      name = _name;
    }
}
1

The memory access specifier is in the wrong place. It should be after the type and before the argument name

constructor(string memory _name) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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