如何在solidity语言中删除此合同的ParserError



我正在使用Remix IDE,下面的inf代码抛出错误:

:browser/tests/project/record.sol:18:21:ParserError:应为";"但是get'[]address docs[]=new;

pragma experimental ABIEncoderV2;
pragma solidity >=0.4.18;
contract Record {
struct MedRecord {
string password;
string name;
address patient;
address[] doctor;
}
mapping(address => MedRecord) internal medRecords;
address[] public recordList;

function addRecord(address _key, string memory password, string memory name) public {
address docs[] = new ;
medRecords[_key] = MedRecord(password, name, _key, []);
recordList.push(_key);
}
function remove(address _key) public {
delete medRecords[_key];
}

// function contains(address _key) public view returns (bool) {
//     return MedRecords[_key][0] != '';
// }

function getByKey(address _key) public view returns (MedRecord memory) {
return medRecords[_key];
}
}

然而,代码对我来说很好。

此语句不完整:

address docs[] = new ;

你应该写这样的东西:

address[] memory docs = new address[](2);

相关内容

  • 没有找到相关文章

最新更新