Skip to content

Instantly share code, notes, and snippets.

@alexroan
Last active March 24, 2020 12:39
Show Gist options
  • Save alexroan/c965192e3f35710f62d778cc3febc5da to your computer and use it in GitHub Desktop.
Save alexroan/c965192e3f35710f62d778cc3febc5da to your computer and use it in GitHub Desktop.
examples/solidity-require-statements
pragma solidity >=0.5.0;
contract RequireStatements {
function someFunction(address _anAddress) external {
// Require that the address given as a parameter is not equal to an empty addess.
// If the address is empty, the whole transaction will not be completed and will be reverted
require(_anAddress != address(0), "Not a valid address");
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment