const data_types_Code: Coding = {
code: "code",
display: "code",
system: "http://hl7.org/fhir/data-types"
};我们如何在坚实的情况下定义这一点?上面的代码在TypeScript中
发布于 2023-02-23 02:26:51
在稳固性中,您可以将Coding类型定义为如下结构:
struct Coding {
string code;
string display;
string system;
}但是,当谈到定义常数值时,在撰写本报告时,它是不可能稳定的。Solidity会给您带来以下错误:TypeError: Only constants of value type and byte array type are implemented.。
您仍然可以将data_types_Code初始化为存储变量,如下所示:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
contract Example {
struct Coding {
string code;
string display;
string system;
}
Coding public data_types_Code = Coding({
code: "code",
display: "code",
system: "http://hl7.org/fhir/data-types"
});
}https://ethereum.stackexchange.com/questions/145433
复制相似问题