solidity return array of struct

The solution for “solidity return array of struct” can be found here. The following code will assist you in solving the problem.

struct MyStruct {
uint8 level
uint8 exp
}

function myFunc() public returns (MyStruct[]) {
return [MyStruct(5, 3), MyStruct(2, 4)]
}

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts