Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brynbellomy/532bdebd382979167e47eeb7222e0342 to your computer and use it in GitHub Desktop.
Save brynbellomy/532bdebd382979167e47eeb7222e0342 to your computer and use it in GitHub Desktop.
medium-return-struct-public-func-4.sol
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