solidity/test/libsolidity/syntaxTests/types/mapping/library_argument_storage.sol

14 lines
296 B
Solidity
Raw Normal View History

2020-06-07 16:00:52 +00:00
library Set {
struct Data { mapping(uint => bool) flags; }
function insert(Data storage self, uint value)
public
returns (bool)
{
if (self.flags[value])
return false; // already there
self.flags[value] = true;
return true;
}
}