pragma solidity >=0.4.25; contract ListUser { struct User { address address; string userName; } User[] public userList; event Shout(address indexed who, string what); function shout(string memory what) public { shoutBoard.push(ShoutMsg(msg.sender, what)); emit Shout(msg.sender, what); } function count() view public returns(uint){ return shoutBoard.length; } function getShouts() view public returns(address[] memory whoList, string memory content) { uint len = shoutBoard.length; bytes memory contentCollector; whoList = new address[](len); for (uint i = 0; i < len; i++) { whoList[i] = shoutBoard[i].who; contentCollector = abi.encodePacked(contentCollector, shoutBoard[i].what, byte(0)); } content = string(contentCollector); } }
0.4.25