Created
July 11, 2017 21:47
-
-
Save brynbellomy/532bdebd382979167e47eeb7222e0342 to your computer and use it in GitHub Desktop.
medium-return-struct-public-func-4.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.13; | |
contract Project | |
{ | |
struct Person { | |
address addr; | |
uint funds; | |
} | |
Person[] people; | |
function getPeople(uint[] indexes) | |
public | |
returns (address[], uint[]) | |
{ | |
address[] memory addrs = new address[](indexes.length); | |
uint[] memory funds = new uint[](indexes.length); | |
for (uint i = 0; i < indexes.length; i++) { | |
Person storage person = people[indexes[i]]; | |
addrs[i] = person.addr; | |
funds[i] = person.funds; | |
} | |
return (addrs, funds); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment