为什么下面的代码包含错误(ParserError: Expected identifier but got '='
)。
contract Test {
struct Box {
uint size;
}
Box public box;
box.size = 3; //<-- error here
constructor() public {
}
}
如果我把它box.size = 3;
放进去constructor
!
contract Test {
struct Box {
uint size;
}
Box public box;
constructor() public {
box.size = 3;
}
}